serializers.dart
。 我实际上如何构建项目以生成
serializers.g.dart
文件?谢谢
最佳答案
在最新版本中,您需要@SerializersFor()
批注
另请参见示例项目https://github.com/google/built_value.dart/blob/master/chat_example/lib/data_model/serializers.dart
library serializers;
import 'package:built_collection/built_collection.dart';
import 'package:built_value/serializer.dart';
import 'package:chat_example/data_model/data_model.dart';
part 'serializers.g.dart';
/// Collection of generated serializers for the built_value chat example.
@SerializersFor(const [
Chat,
ListUsers,
ListUsersResponse,
Login,
LoginResponse,
ShowChat,
Status,
Welcome,
])
final Serializers serializers = _$serializers;