The argument type 'String?' can't be assigned to the parameter type 'String'
来源:5-11 带你揭开Flutter中的面向对象(get和set、静态方法)
慕无忌6890528
2022-02-17
具体报错内容:
lib/Object_type_oop.dart:201:37: Error: The argument type ‘String?’ can’t be assigned to the parameter type ‘String’ because ‘String?’ is nullable and ‘String’ isn’t.
return Student(stu._school, stu.name, stu.age);
希望老师能够解答, 谢谢 。
写回答
2回答
-
CrazyCodeBoy
2022-02-18
String get 改成了String? get
00 -
CrazyCodeBoy
2022-02-17
完整代码贴一下我帮你看看
012022-02-17