I am new to flutter and the objective is to serialise complex JSON objects which contain other smaller objects.
Using the json_serializable: ^2.0.0 and
json_serializable: ^2.0.0
The constructor's argument shouldn't be optional
User({this.firstName, this.lastName, this.dateOfBirth});
They should be obligatory:
User(this.firstName, this.lastName, this.dateOfBirth);
And the part
'user.g.dart';
should be matching the Uppercase User class:
part 'User.g.dart';