platform/angel_serialize_generator/test/models/has_map.g.dart

94 lines
2.2 KiB
Dart
Raw Normal View History

2019-01-07 01:38:04 +00:00
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'has_map.dart';
// **************************************************************************
// JsonModelGenerator
// **************************************************************************
@generatedSerializable
class HasMap implements _HasMap {
const HasMap({@required Map<dynamic, dynamic> this.value});
@override
final Map<dynamic, dynamic> value;
HasMap copyWith({Map<dynamic, dynamic> value}) {
2019-04-30 15:44:01 +00:00
return HasMap(value: value ?? this.value);
2019-01-07 01:38:04 +00:00
}
bool operator ==(other) {
return other is _HasMap &&
2019-04-30 15:44:01 +00:00
MapEquality<dynamic, dynamic>(
keys: DefaultEquality(), values: DefaultEquality())
2019-01-07 01:38:04 +00:00
.equals(other.value, value);
}
@override
int get hashCode {
return hashObjects([value]);
}
2019-04-08 15:00:04 +00:00
@override
String toString() {
return "HasMap(value=$value)";
}
2019-01-07 01:38:04 +00:00
Map<String, dynamic> toJson() {
return HasMapSerializer.toMap(this);
}
}
// **************************************************************************
// SerializerGenerator
// **************************************************************************
2019-04-30 15:44:01 +00:00
const HasMapSerializer hasMapSerializer = HasMapSerializer();
2019-04-08 15:00:04 +00:00
class HasMapEncoder extends Converter<HasMap, Map> {
const HasMapEncoder();
@override
Map convert(HasMap model) => HasMapSerializer.toMap(model);
}
class HasMapDecoder extends Converter<Map, HasMap> {
const HasMapDecoder();
@override
HasMap convert(Map map) => HasMapSerializer.fromMap(map);
}
class HasMapSerializer extends Codec<HasMap, Map> {
const HasMapSerializer();
@override
get encoder => const HasMapEncoder();
@override
get decoder => const HasMapDecoder();
2019-01-07 01:38:04 +00:00
static HasMap fromMap(Map map) {
if (map['value'] == null) {
2019-04-30 15:44:01 +00:00
throw FormatException("Missing required field 'value' on HasMap.");
2019-01-07 01:38:04 +00:00
}
2019-04-30 15:44:01 +00:00
return HasMap(value: _fromString(map['value']));
2019-01-07 01:38:04 +00:00
}
static Map<String, dynamic> toMap(_HasMap model) {
if (model == null) {
return null;
}
if (model.value == null) {
2019-04-30 15:44:01 +00:00
throw FormatException("Missing required field 'value' on HasMap.");
2019-01-07 01:38:04 +00:00
}
return {'value': _toString(model.value)};
}
}
abstract class HasMapFields {
2019-04-04 21:40:36 +00:00
static const List<String> allFields = <String>[value];
2019-01-07 01:38:04 +00:00
static const String value = 'value';
}