I am getting error: Undefined class 'required'. when trying to use required keyword.
Here is the code sample:
class Field {
final int id;
final String name;
final bool userEditable;
final String title;
Field({
required this.id,
this.name,
this.userEditable,
this.title,
});
}
I am already using flutter's @required keyword but I trying to switch to dart's new required keyword.
Here is pubspec.yaml's enviroment sdk line:
environment:
sdk: ">=2.7.0 <3.0.0"
Here is output of flutter --version:
Flutter 2.0.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision c5a4b4029c (2 weeks ago) • 2021-03-04 09:47:48 -0800
Engine • revision 40441def69
Tools • Dart 2.12.0
