skip to Main Content

This is rout file and this code is rout of EditProfilePage

This image is EditProfilePage, This code is required things and facing the error because of this.

I expecting the solution of this related error in flutter technology.

2

Answers


  1. You need to pass a UserProfile instance on userProfile and the onUpdate is a callback method which return a UserProfile.

    So while creating EditProfilePage it will be like

    UserProfile myUserProfileInstance  = UserProfile(....);
      EditProfilePage( userProfile: myUserProfileInstance, 
      onUpdate: (value){
       ///receive update value
      }
    );
    
    
    Login or Signup to reply.
  2. You have to watch out for the types
    An empty String is not a valid default value for a callback or an Object

    You can create default values for your classes, for example:

    class UserProfile {
      UserProfile({
        required this.name,
        required this.email,
      });
    
      final String name;
      final String email;
    
      static UserProfile defaultValue() => UserProfile(
        name: '',
        email: '',
      );
    }
    

    Now if you have to use a UserProfile defaultValue

    EditProfilePage(
      userProfile: UserProfile.defaultValue(),
      onUpdate: (value) {}
    )
    

    For your last comment in the previous answer, did you forget to pass (value) {} instead of '' in the field onUpdate?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search