We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Currently this is how my Teacher class is being generated:
class Teachers { String id; DateTime created_at; DateTime updated_at; String name; bool is_enabled; Teachers({ required this.id, required this.created_at, required this.updated_at, required this.name, required this.is_enabled, }); static String get table_name => 'teachers'; static String get c_id => 'id'; static String get c_created_at => 'created_at'; static String get c_updated_at => 'updated_at'; static String get c_name => 'name'; static String get c_is_enabled => 'is_enabled'; static Map<String, dynamic> insert({ String? id, DateTime? created_at, DateTime? updated_at, required String name, bool? is_enabled, }) { return { if (id != null) 'id': id.toString(), if (created_at != null) 'created_at': created_at.toUtc().toString(), if (updated_at != null) 'updated_at': updated_at.toUtc().toString(), 'name': name.toString(), if (is_enabled != null) 'is_enabled': is_enabled.toString(), }; } static Map<String, dynamic> update({ String? id, DateTime? created_at, DateTime? updated_at, String? name, bool? is_enabled, }) { return { if (id != null) 'id': id.toString(), if (created_at != null) 'created_at': created_at.toUtc().toString(), if (updated_at != null) 'updated_at': updated_at.toUtc().toString(), if (name != null) 'name': name.toString(), if (is_enabled != null) 'is_enabled': is_enabled.toString(), }; } factory Teachers.fromJson(Map<String, dynamic> json) { return Teachers( id: json['id'] as String, created_at: DateTime.parse(json['created_at'].toString()), updated_at: DateTime.parse(json['updated_at'].toString()), name: json['name'] as String, is_enabled: json['is_enabled'] as bool, ); } }
Whereas it should be immutable by default:
class Teachers { final String id; final DateTime created_at; final DateTime updated_at; final String name; final bool is_enabled; const Teachers({ required this.id, required this.created_at, required this.updated_at, required this.name, required this.is_enabled, }); static String get table_name => 'teachers'; static String get c_id => 'id'; static String get c_created_at => 'created_at'; static String get c_updated_at => 'updated_at'; static String get c_name => 'name'; static String get c_is_enabled => 'is_enabled'; static Map<String, dynamic> insert({ String? id, DateTime? created_at, DateTime? updated_at, required String name, bool? is_enabled, }) { return { if (id != null) 'id': id.toString(), if (created_at != null) 'created_at': created_at.toUtc().toString(), if (updated_at != null) 'updated_at': updated_at.toUtc().toString(), 'name': name.toString(), if (is_enabled != null) 'is_enabled': is_enabled.toString(), }; } static Map<String, dynamic> update({ String? id, DateTime? created_at, DateTime? updated_at, String? name, bool? is_enabled, }) { return { if (id != null) 'id': id.toString(), if (created_at != null) 'created_at': created_at.toUtc().toString(), if (updated_at != null) 'updated_at': updated_at.toUtc().toString(), if (name != null) 'name': name.toString(), if (is_enabled != null) 'is_enabled': is_enabled.toString(), }; } factory Teachers.fromJson(Map<String, dynamic> json) { return Teachers( id: json['id'] as String, created_at: DateTime.parse(json['created_at'].toString()), updated_at: DateTime.parse(json['updated_at'].toString()), name: json['name'] as String, is_enabled: json['is_enabled'] as bool, ); } }
The text was updated successfully, but these errors were encountered:
Would love to have your feedback on this
Sorry, something went wrong.
lgtm 💪
mmvergara
Successfully merging a pull request may close this issue.
Currently this is how my Teacher class is being generated:
Whereas it should be immutable by default:
The text was updated successfully, but these errors were encountered: