Skip to content

type 'Null' is not a subtype of type 'String' #13

@amkfat

Description

@amkfat

i'm using a new version of flutter
i get this error: type 'Null' is not a subtype of type 'String'

at the 3rd this line of the code (plan_services.dart):

  Plan createPlan(String name) {
    final model = _repository.create();
    print('my name $name');                                           //the name in not null here
    final plan = Plan.fromModel(model)..name = name;            //error here
    savePlan(plan);
    return plan;
  }

after debugging, i got name=null here (plan.dart)

  Plan.fromModel(Model model)
      : id = model.id,
        name = model.data['name'],             //the name is null here
        tasks = model.data['task']
                ?.map<Task>((task) => Task.fromModel(task))
                ?.toList() ??
            <Task>[];

can you explain why? thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions