model_annotation 0.0.2
model_annotation: ^0.0.2 copied to clipboard
Library used to generate code snippets for data extraction and conversion between Model and Entity
Usage #
run build_runner build --delete-conflicting-outputs
Configure #
import 'package:example/_model.dart';
import 'package:model_annotation/model_annotation.dart';
@ModelAnnotation()
class MyModel extends Model {
@FieldAnnotation(parseJson: false)
final int? id;
final String? message;
final DateTime? dateTime;
MyModel(
this.id, {
required this.message,
this.dateTime,
});
}
File *.g.dart #
import 'package:example/_model.dart';
import 'package:model_annotation/model_annotation.dart';
@ModelAnnotation()
class MyModel extends Model {
@FieldAnnotation(parseJson: false)
final int? id;
@FieldAnnotation()
final String? message;
final DateTime? dateTime;
MyModel(
this.id, {
required this.message,
this.dateTime,
});
}