1
0
mirror of https://github.com/flutter/samples.git synced 2026-03-23 12:51:57 +00:00

Samples maintenance (#435)

This commit is contained in:
Brett Morgan
2020-05-13 09:18:26 +10:00
committed by GitHub
parent 941ebebfad
commit baa1f976b2
94 changed files with 492 additions and 349 deletions

View File

@@ -121,13 +121,13 @@ void main() {
test('Typical object is converted correctly', () {
final complexObject = ConvertedComplexObject.fromJson(typicalObjectJson);
expect(complexObject.aString, "Blah, blah, blah.");
expect(complexObject.aString, 'Blah, blah, blah.');
expect(complexObject.anInt, 1);
expect(complexObject.aDouble, 1.0);
expect(complexObject.aListOfStrings, ['one', 'two', 'three']);
expect(complexObject.aListOfInts, [1, 2, 3]);
expect(complexObject.aListOfDoubles, [1.0, 2.0, 3.0]);
expect(complexObject.anObject.aString, "Blah, blah, blah.");
expect(complexObject.anObject.aString, 'Blah, blah, blah.');
expect(complexObject.anObject.anInt, 1);
expect(complexObject.anObject.aDouble, 1.0);
expect(complexObject.anObject.aListOfStrings, ['one', 'two', 'three']);
@@ -135,8 +135,8 @@ void main() {
expect(complexObject.anObject.aListOfDoubles, [1.0, 2.0, 3.0]);
expect(complexObject.aListOfObjects.length, 3);
for (int i = 0; i < 3; i++) {
expect(complexObject.aListOfObjects[i].aString, "Blah, blah, blah.");
for (var i = 0; i < 3; i++) {
expect(complexObject.aListOfObjects[i].aString, 'Blah, blah, blah.');
expect(complexObject.aListOfObjects[i].anInt, i + 1);
expect(complexObject.aListOfObjects[i].aDouble, 1.0);
expect(complexObject.aListOfObjects[i].aListOfStrings,
@@ -163,7 +163,7 @@ void main() {
final complexObject =
ConvertedComplexObject.fromJson(emptySimpleObjectsJson);
expect(complexObject.aString, "Blah, blah, blah.");
expect(complexObject.aString, 'Blah, blah, blah.');
expect(complexObject.anInt, 1);
expect(complexObject.aDouble, 1.0);
expect(complexObject.aListOfStrings, ['one', 'two', 'three']);
@@ -177,7 +177,7 @@ void main() {
expect(complexObject.anObject.aListOfDoubles, isNull);
expect(complexObject.aListOfObjects.length, 3);
for (int i = 0; i < 3; i++) {
for (var i = 0; i < 3; i++) {
expect(complexObject.aListOfObjects[i].aString, isNull);
expect(complexObject.aListOfObjects[i].anInt, isNull);
expect(complexObject.aListOfObjects[i].aDouble, isNull);
@@ -191,13 +191,13 @@ void main() {
final complexObject =
ConvertedComplexObject.fromJson(unexpectedPropertiesJson);
expect(complexObject.aString, "Blah, blah, blah.");
expect(complexObject.aString, 'Blah, blah, blah.');
expect(complexObject.anInt, 1);
expect(complexObject.aDouble, 1.0);
expect(complexObject.aListOfStrings, ['one', 'two', 'three']);
expect(complexObject.aListOfInts, [1, 2, 3]);
expect(complexObject.aListOfDoubles, [1.0, 2.0, 3.0]);
expect(complexObject.anObject.aString, "Blah, blah, blah.");
expect(complexObject.anObject.aString, 'Blah, blah, blah.');
expect(complexObject.anObject.anInt, 1);
expect(complexObject.anObject.aDouble, 1.0);
expect(complexObject.anObject.aListOfStrings, ['one', 'two', 'three']);
@@ -205,8 +205,8 @@ void main() {
expect(complexObject.anObject.aListOfDoubles, [1.0, 2.0, 3.0]);
expect(complexObject.aListOfObjects.length, 3);
for (int i = 0; i < 3; i++) {
expect(complexObject.aListOfObjects[i].aString, "Blah, blah, blah.");
for (var i = 0; i < 3; i++) {
expect(complexObject.aListOfObjects[i].aString, 'Blah, blah, blah.');
expect(complexObject.aListOfObjects[i].anInt, i + 1);
expect(complexObject.aListOfObjects[i].aDouble, 1.0);
expect(complexObject.aListOfObjects[i].aListOfStrings,
@@ -222,13 +222,13 @@ void main() {
final complexObject =
SerializableComplexObject.fromJson(typicalObjectJson);
expect(complexObject.aString, "Blah, blah, blah.");
expect(complexObject.aString, 'Blah, blah, blah.');
expect(complexObject.anInt, 1);
expect(complexObject.aDouble, 1.0);
expect(complexObject.aListOfStrings, ['one', 'two', 'three']);
expect(complexObject.aListOfInts, [1, 2, 3]);
expect(complexObject.aListOfDoubles, [1.0, 2.0, 3.0]);
expect(complexObject.anObject.aString, "Blah, blah, blah.");
expect(complexObject.anObject.aString, 'Blah, blah, blah.');
expect(complexObject.anObject.anInt, 1);
expect(complexObject.anObject.aDouble, 1.0);
expect(complexObject.anObject.aListOfStrings, ['one', 'two', 'three']);
@@ -236,8 +236,8 @@ void main() {
expect(complexObject.anObject.aListOfDoubles, [1.0, 2.0, 3.0]);
expect(complexObject.aListOfObjects.length, 3);
for (int i = 0; i < 3; i++) {
expect(complexObject.aListOfObjects[i].aString, "Blah, blah, blah.");
for (var i = 0; i < 3; i++) {
expect(complexObject.aListOfObjects[i].aString, 'Blah, blah, blah.');
expect(complexObject.aListOfObjects[i].anInt, i + 1);
expect(complexObject.aListOfObjects[i].aDouble, 1.0);
expect(complexObject.aListOfObjects[i].aListOfStrings,
@@ -264,7 +264,7 @@ void main() {
final complexObject =
SerializableComplexObject.fromJson(emptySimpleObjectsJson);
expect(complexObject.aString, "Blah, blah, blah.");
expect(complexObject.aString, 'Blah, blah, blah.');
expect(complexObject.anInt, 1);
expect(complexObject.aDouble, 1.0);
expect(complexObject.aListOfStrings, ['one', 'two', 'three']);
@@ -278,7 +278,7 @@ void main() {
expect(complexObject.anObject.aListOfDoubles, isNull);
expect(complexObject.aListOfObjects.length, 3);
for (int i = 0; i < 3; i++) {
for (var i = 0; i < 3; i++) {
expect(complexObject.aListOfObjects[i].aString, isNull);
expect(complexObject.aListOfObjects[i].anInt, isNull);
expect(complexObject.aListOfObjects[i].aDouble, isNull);
@@ -292,13 +292,13 @@ void main() {
final complexObject =
SerializableComplexObject.fromJson(unexpectedPropertiesJson);
expect(complexObject.aString, "Blah, blah, blah.");
expect(complexObject.aString, 'Blah, blah, blah.');
expect(complexObject.anInt, 1);
expect(complexObject.aDouble, 1.0);
expect(complexObject.aListOfStrings, ['one', 'two', 'three']);
expect(complexObject.aListOfInts, [1, 2, 3]);
expect(complexObject.aListOfDoubles, [1.0, 2.0, 3.0]);
expect(complexObject.anObject.aString, "Blah, blah, blah.");
expect(complexObject.anObject.aString, 'Blah, blah, blah.');
expect(complexObject.anObject.anInt, 1);
expect(complexObject.anObject.aDouble, 1.0);
expect(complexObject.anObject.aListOfStrings, ['one', 'two', 'three']);
@@ -306,8 +306,8 @@ void main() {
expect(complexObject.anObject.aListOfDoubles, [1.0, 2.0, 3.0]);
expect(complexObject.aListOfObjects.length, 3);
for (int i = 0; i < 3; i++) {
expect(complexObject.aListOfObjects[i].aString, "Blah, blah, blah.");
for (var i = 0; i < 3; i++) {
expect(complexObject.aListOfObjects[i].aString, 'Blah, blah, blah.');
expect(complexObject.aListOfObjects[i].anInt, i + 1);
expect(complexObject.aListOfObjects[i].aDouble, 1.0);
expect(complexObject.aListOfObjects[i].aListOfStrings,
@@ -323,13 +323,13 @@ void main() {
final complexObject = serializers.deserializeWith(
BuiltComplexObject.serializer, typicalObjectJson);
expect(complexObject.aString, "Blah, blah, blah.");
expect(complexObject.aString, 'Blah, blah, blah.');
expect(complexObject.anInt, 1);
expect(complexObject.aDouble, 1.0);
expect(complexObject.aListOfStrings, ['one', 'two', 'three']);
expect(complexObject.aListOfInts, [1, 2, 3]);
expect(complexObject.aListOfDoubles, [1.0, 2.0, 3.0]);
expect(complexObject.anObject.aString, "Blah, blah, blah.");
expect(complexObject.anObject.aString, 'Blah, blah, blah.');
expect(complexObject.anObject.anInt, 1);
expect(complexObject.anObject.aDouble, 1.0);
expect(complexObject.anObject.aListOfStrings, ['one', 'two', 'three']);
@@ -337,8 +337,8 @@ void main() {
expect(complexObject.anObject.aListOfDoubles, [1.0, 2.0, 3.0]);
expect(complexObject.aListOfObjects.length, 3);
for (int i = 0; i < 3; i++) {
expect(complexObject.aListOfObjects[i].aString, "Blah, blah, blah.");
for (var i = 0; i < 3; i++) {
expect(complexObject.aListOfObjects[i].aString, 'Blah, blah, blah.');
expect(complexObject.aListOfObjects[i].anInt, i + 1);
expect(complexObject.aListOfObjects[i].aDouble, 1.0);
expect(complexObject.aListOfObjects[i].aListOfStrings,
@@ -366,7 +366,7 @@ void main() {
final complexObject = serializers.deserializeWith(
BuiltComplexObject.serializer, emptySimpleObjectsJson);
expect(complexObject.aString, "Blah, blah, blah.");
expect(complexObject.aString, 'Blah, blah, blah.');
expect(complexObject.anInt, 1);
expect(complexObject.aDouble, 1.0);
expect(complexObject.aListOfStrings, ['one', 'two', 'three']);
@@ -380,7 +380,7 @@ void main() {
expect(complexObject.anObject.aListOfDoubles, isNull);
expect(complexObject.aListOfObjects.length, 3);
for (int i = 0; i < 3; i++) {
for (var i = 0; i < 3; i++) {
expect(complexObject.aListOfObjects[i].aString, isNull);
expect(complexObject.aListOfObjects[i].anInt, isNull);
expect(complexObject.aListOfObjects[i].aDouble, isNull);
@@ -394,13 +394,13 @@ void main() {
final complexObject = serializers.deserializeWith(
BuiltComplexObject.serializer, unexpectedPropertiesJson);
expect(complexObject.aString, "Blah, blah, blah.");
expect(complexObject.aString, 'Blah, blah, blah.');
expect(complexObject.anInt, 1);
expect(complexObject.aDouble, 1.0);
expect(complexObject.aListOfStrings, ['one', 'two', 'three']);
expect(complexObject.aListOfInts, [1, 2, 3]);
expect(complexObject.aListOfDoubles, [1.0, 2.0, 3.0]);
expect(complexObject.anObject.aString, "Blah, blah, blah.");
expect(complexObject.anObject.aString, 'Blah, blah, blah.');
expect(complexObject.anObject.anInt, 1);
expect(complexObject.anObject.aDouble, 1.0);
expect(complexObject.anObject.aListOfStrings, ['one', 'two', 'three']);
@@ -408,8 +408,8 @@ void main() {
expect(complexObject.anObject.aListOfDoubles, [1.0, 2.0, 3.0]);
expect(complexObject.aListOfObjects.length, 3);
for (int i = 0; i < 3; i++) {
expect(complexObject.aListOfObjects[i].aString, "Blah, blah, blah.");
for (var i = 0; i < 3; i++) {
expect(complexObject.aListOfObjects[i].aString, 'Blah, blah, blah.');
expect(complexObject.aListOfObjects[i].anInt, i + 1);
expect(complexObject.aListOfObjects[i].aDouble, 1.0);
expect(complexObject.aListOfObjects[i].aListOfStrings,

View File

@@ -46,7 +46,7 @@ void main() {
final simpleObject = ConvertedSimpleObject.fromJson(typicalObjectJson);
expect(simpleObject, isNotNull);
expect(simpleObject.aString, "Blah, blah, blah.");
expect(simpleObject.aString, 'Blah, blah, blah.');
expect(simpleObject.anInt, 1);
expect(simpleObject.aDouble, 1.0);
expect(simpleObject.aListOfStrings, ['one', 'two', 'three']);
@@ -70,7 +70,7 @@ void main() {
final simpleObject = ConvertedSimpleObject.fromJson(emptyListJson);
expect(simpleObject, isNotNull);
expect(simpleObject.aString, "Blah, blah, blah.");
expect(simpleObject.aString, 'Blah, blah, blah.');
expect(simpleObject.anInt, 1);
expect(simpleObject.aDouble, 1.0);
expect(simpleObject.aListOfStrings, <String>[]);
@@ -83,7 +83,7 @@ void main() {
ConvertedSimpleObject.fromJson(unexpectedPropertiesJson);
expect(simpleObject, isNotNull);
expect(simpleObject.aString, "Blah, blah, blah.");
expect(simpleObject.aString, 'Blah, blah, blah.');
expect(simpleObject.anInt, 1);
expect(simpleObject.aDouble, 1.0);
expect(simpleObject.aListOfStrings, ['one', 'two', 'three']);
@@ -97,7 +97,7 @@ void main() {
final simpleObject = SerializableSimpleObject.fromJson(typicalObjectJson);
expect(simpleObject, isNotNull);
expect(simpleObject.aString, "Blah, blah, blah.");
expect(simpleObject.aString, 'Blah, blah, blah.');
expect(simpleObject.anInt, 1);
expect(simpleObject.aDouble, 1.0);
expect(simpleObject.aListOfStrings, ['one', 'two', 'three']);
@@ -121,7 +121,7 @@ void main() {
final simpleObject = SerializableSimpleObject.fromJson(emptyListJson);
expect(simpleObject, isNotNull);
expect(simpleObject.aString, "Blah, blah, blah.");
expect(simpleObject.aString, 'Blah, blah, blah.');
expect(simpleObject.anInt, 1);
expect(simpleObject.aDouble, 1.0);
expect(simpleObject.aListOfStrings, <String>[]);
@@ -134,7 +134,7 @@ void main() {
SerializableSimpleObject.fromJson(unexpectedPropertiesJson);
expect(simpleObject, isNotNull);
expect(simpleObject.aString, "Blah, blah, blah.");
expect(simpleObject.aString, 'Blah, blah, blah.');
expect(simpleObject.anInt, 1);
expect(simpleObject.aDouble, 1.0);
expect(simpleObject.aListOfStrings, ['one', 'two', 'three']);
@@ -149,7 +149,7 @@ void main() {
BuiltSimpleObject.serializer, typicalObjectJson);
expect(simpleObject, isNotNull);
expect(simpleObject.aString, "Blah, blah, blah.");
expect(simpleObject.aString, 'Blah, blah, blah.');
expect(simpleObject.anInt, 1);
expect(simpleObject.aDouble, 1.0);
expect(simpleObject.aListOfStrings, ['one', 'two', 'three']);
@@ -175,7 +175,7 @@ void main() {
BuiltSimpleObject.serializer, emptyListJson);
expect(simpleObject, isNotNull);
expect(simpleObject.aString, "Blah, blah, blah.");
expect(simpleObject.aString, 'Blah, blah, blah.');
expect(simpleObject.anInt, 1);
expect(simpleObject.aDouble, 1.0);
expect(simpleObject.aListOfStrings, <String>[]);
@@ -188,7 +188,7 @@ void main() {
BuiltSimpleObject.serializer, unexpectedPropertiesJson);
expect(simpleObject, isNotNull);
expect(simpleObject.aString, "Blah, blah, blah.");
expect(simpleObject.aString, 'Blah, blah, blah.');
expect(simpleObject.anInt, 1);
expect(simpleObject.aDouble, 1.0);
expect(simpleObject.aListOfStrings, ['one', 'two', 'three']);

View File

@@ -83,7 +83,7 @@ void main() {
aListOfInts: [1, 2, 3],
aListOfDoubles: [1.0, 2.0, 3.0],
anObject: ConvertedSimpleObject(
aString: "Child 1",
aString: 'Child 1',
anInt: 101,
aDouble: 101.0,
aListOfStrings: ['1011', '1012', '1013'],
@@ -92,7 +92,7 @@ void main() {
),
aListOfObjects: [
ConvertedSimpleObject(
aString: "Child 2",
aString: 'Child 2',
anInt: 102,
aDouble: 102.0,
aListOfStrings: ['1021', '1022', '1023'],
@@ -100,7 +100,7 @@ void main() {
aListOfDoubles: [1021.0, 1022.0, 1023.0],
),
ConvertedSimpleObject(
aString: "Child 3",
aString: 'Child 3',
anInt: 103,
aDouble: 103.0,
aListOfStrings: ['1031', '1032', '1033'],
@@ -108,7 +108,7 @@ void main() {
aListOfDoubles: [1031.0, 1032.0, 1033.0],
),
ConvertedSimpleObject(
aString: "Child 4",
aString: 'Child 4',
anInt: 104,
aDouble: 104.0,
aListOfStrings: ['1041', '1042', '1043'],
@@ -131,7 +131,7 @@ void main() {
expect(find.text('[1, 2, 3]'), findsOneWidget);
expect(find.text('[1.0, 2.0, 3.0]'), findsOneWidget);
for (int i = 1; i <= 4; i++) {
for (var i = 1; i <= 4; i++) {
expect(find.text('"Child $i"'), findsOneWidget);
expect(find.text('10$i'), findsOneWidget);
expect(find.text('10$i.0'), findsOneWidget);
@@ -150,7 +150,7 @@ void main() {
aListOfInts: [],
aListOfDoubles: [],
anObject: ConvertedSimpleObject(
aString: "Child 1",
aString: 'Child 1',
anInt: 101,
aDouble: 101.0,
aListOfStrings: ['1011', '1012', '1013'],