editProfile function

void editProfile(
  1. BuildContext context
)

This function is executed when the "View my profile" button is pressed Its only argument is context in order to access the providers. The function sets PersonalDataProvider.editingMode to true and assigns the active user to PersonalDataProvider.tempUser before navigating to the new profile screen

Implementation

void editProfile(BuildContext context){
  final personalDataProvider = Provider.of<PersonalDataProvider>(context, listen: false);

  personalDataProvider.tempUser = personalDataProvider.profilesList[personalDataProvider.activeUser ?? 0];
  personalDataProvider.setEditingMode(true);
  Navigator.pushNamed(context, '/newProfileScreen');
}