mirror of
https://github.com/flutter/samples.git
synced 2026-03-28 23:32:05 +00:00
@@ -17,7 +17,7 @@ class _$BuiltComplexObjectSerializer
|
||||
final String wireName = 'BuiltComplexObject';
|
||||
|
||||
@override
|
||||
Iterable serialize(Serializers serializers, BuiltComplexObject object,
|
||||
Iterable<Object> serialize(Serializers serializers, BuiltComplexObject object,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = <Object>[];
|
||||
if (object.aString != null) {
|
||||
@@ -72,12 +72,12 @@ class _$BuiltComplexObjectSerializer
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(BuiltSimpleObject)])));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@override
|
||||
BuiltComplexObject deserialize(Serializers serializers, Iterable serialized,
|
||||
BuiltComplexObject deserialize(
|
||||
Serializers serializers, Iterable<Object> serialized,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = new BuiltComplexObjectBuilder();
|
||||
|
||||
@@ -108,25 +108,25 @@ class _$BuiltComplexObjectSerializer
|
||||
result.aListOfStrings.replace(serializers.deserialize(value,
|
||||
specifiedType:
|
||||
const FullType(BuiltList, const [const FullType(String)]))
|
||||
as BuiltList);
|
||||
as BuiltList<dynamic>);
|
||||
break;
|
||||
case 'aListOfInts':
|
||||
result.aListOfInts.replace(serializers.deserialize(value,
|
||||
specifiedType:
|
||||
const FullType(BuiltList, const [const FullType(int)]))
|
||||
as BuiltList);
|
||||
as BuiltList<dynamic>);
|
||||
break;
|
||||
case 'aListOfDoubles':
|
||||
result.aListOfDoubles.replace(serializers.deserialize(value,
|
||||
specifiedType:
|
||||
const FullType(BuiltList, const [const FullType(double)]))
|
||||
as BuiltList);
|
||||
as BuiltList<dynamic>);
|
||||
break;
|
||||
case 'aListOfObjects':
|
||||
result.aListOfObjects.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(BuiltSimpleObject)]))
|
||||
as BuiltList);
|
||||
as BuiltList<dynamic>);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ class _$BuiltSimpleObjectSerializer
|
||||
final String wireName = 'BuiltSimpleObject';
|
||||
|
||||
@override
|
||||
Iterable serialize(Serializers serializers, BuiltSimpleObject object,
|
||||
Iterable<Object> serialize(Serializers serializers, BuiltSimpleObject object,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = <Object>[];
|
||||
if (object.aString != null) {
|
||||
@@ -59,12 +59,12 @@ class _$BuiltSimpleObjectSerializer
|
||||
specifiedType:
|
||||
const FullType(BuiltList, const [const FullType(double)])));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@override
|
||||
BuiltSimpleObject deserialize(Serializers serializers, Iterable serialized,
|
||||
BuiltSimpleObject deserialize(
|
||||
Serializers serializers, Iterable<Object> serialized,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = new BuiltSimpleObjectBuilder();
|
||||
|
||||
@@ -90,19 +90,19 @@ class _$BuiltSimpleObjectSerializer
|
||||
result.aListOfStrings.replace(serializers.deserialize(value,
|
||||
specifiedType:
|
||||
const FullType(BuiltList, const [const FullType(String)]))
|
||||
as BuiltList);
|
||||
as BuiltList<dynamic>);
|
||||
break;
|
||||
case 'aListOfInts':
|
||||
result.aListOfInts.replace(serializers.deserialize(value,
|
||||
specifiedType:
|
||||
const FullType(BuiltList, const [const FullType(int)]))
|
||||
as BuiltList);
|
||||
as BuiltList<dynamic>);
|
||||
break;
|
||||
case 'aListOfDoubles':
|
||||
result.aListOfDoubles.replace(serializers.deserialize(value,
|
||||
specifiedType:
|
||||
const FullType(BuiltList, const [const FullType(double)]))
|
||||
as BuiltList);
|
||||
as BuiltList<dynamic>);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,25 +9,25 @@ part of 'serializable_complex_object.dart';
|
||||
SerializableComplexObject _$SerializableComplexObjectFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return SerializableComplexObject(
|
||||
aString: json['aString'] as String,
|
||||
anInt: json['anInt'] as int,
|
||||
aDouble: (json['aDouble'] as num)?.toDouble(),
|
||||
anObject: json['anObject'] == null
|
||||
? null
|
||||
: SerializableSimpleObject.fromJson(
|
||||
json['anObject'] as Map<String, dynamic>),
|
||||
aListOfStrings:
|
||||
(json['aListOfStrings'] as List)?.map((e) => e as String)?.toList(),
|
||||
aListOfInts:
|
||||
(json['aListOfInts'] as List)?.map((e) => e as int)?.toList(),
|
||||
aListOfDoubles: (json['aListOfDoubles'] as List)
|
||||
?.map((e) => (e as num)?.toDouble())
|
||||
?.toList(),
|
||||
aListOfObjects: (json['aListOfObjects'] as List)
|
||||
?.map((e) => e == null
|
||||
? null
|
||||
: SerializableSimpleObject.fromJson(e as Map<String, dynamic>))
|
||||
?.toList());
|
||||
aString: json['aString'] as String,
|
||||
anInt: json['anInt'] as int,
|
||||
aDouble: (json['aDouble'] as num)?.toDouble(),
|
||||
anObject: json['anObject'] == null
|
||||
? null
|
||||
: SerializableSimpleObject.fromJson(
|
||||
json['anObject'] as Map<String, dynamic>),
|
||||
aListOfStrings:
|
||||
(json['aListOfStrings'] as List)?.map((e) => e as String)?.toList(),
|
||||
aListOfInts: (json['aListOfInts'] as List)?.map((e) => e as int)?.toList(),
|
||||
aListOfDoubles: (json['aListOfDoubles'] as List)
|
||||
?.map((e) => (e as num)?.toDouble())
|
||||
?.toList(),
|
||||
aListOfObjects: (json['aListOfObjects'] as List)
|
||||
?.map((e) => e == null
|
||||
? null
|
||||
: SerializableSimpleObject.fromJson(e as Map<String, dynamic>))
|
||||
?.toList(),
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$SerializableComplexObjectToJson(
|
||||
@@ -40,5 +40,5 @@ Map<String, dynamic> _$SerializableComplexObjectToJson(
|
||||
'aListOfStrings': instance.aListOfStrings,
|
||||
'aListOfInts': instance.aListOfInts,
|
||||
'aListOfDoubles': instance.aListOfDoubles,
|
||||
'aListOfObjects': instance.aListOfObjects
|
||||
'aListOfObjects': instance.aListOfObjects,
|
||||
};
|
||||
|
||||
@@ -9,16 +9,16 @@ part of 'serializable_simple_object.dart';
|
||||
SerializableSimpleObject _$SerializableSimpleObjectFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return SerializableSimpleObject(
|
||||
aString: json['aString'] as String,
|
||||
anInt: json['anInt'] as int,
|
||||
aDouble: (json['aDouble'] as num)?.toDouble(),
|
||||
aListOfStrings:
|
||||
(json['aListOfStrings'] as List)?.map((e) => e as String)?.toList(),
|
||||
aListOfInts:
|
||||
(json['aListOfInts'] as List)?.map((e) => e as int)?.toList(),
|
||||
aListOfDoubles: (json['aListOfDoubles'] as List)
|
||||
?.map((e) => (e as num)?.toDouble())
|
||||
?.toList());
|
||||
aString: json['aString'] as String,
|
||||
anInt: json['anInt'] as int,
|
||||
aDouble: (json['aDouble'] as num)?.toDouble(),
|
||||
aListOfStrings:
|
||||
(json['aListOfStrings'] as List)?.map((e) => e as String)?.toList(),
|
||||
aListOfInts: (json['aListOfInts'] as List)?.map((e) => e as int)?.toList(),
|
||||
aListOfDoubles: (json['aListOfDoubles'] as List)
|
||||
?.map((e) => (e as num)?.toDouble())
|
||||
?.toList(),
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> _$SerializableSimpleObjectToJson(
|
||||
@@ -29,5 +29,5 @@ Map<String, dynamic> _$SerializableSimpleObjectToJson(
|
||||
'aDouble': instance.aDouble,
|
||||
'aListOfStrings': instance.aListOfStrings,
|
||||
'aListOfInts': instance.aListOfInts,
|
||||
'aListOfDoubles': instance.aListOfDoubles
|
||||
'aListOfDoubles': instance.aListOfDoubles,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user