1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 13:58:47 +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

@@ -1,4 +1,4 @@
include: package:pedantic/analysis_options.1.8.0.yaml
include: package:pedantic/analysis_options.1.9.0.yaml
analyzer:
exclude:

View File

@@ -149,7 +149,7 @@ class BasicsPage extends StatelessWidget {
class ConvertedSimplePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
List<ConvertedSimpleObject> objects = JsonStrings.simpleObjects.map(
var objects = JsonStrings.simpleObjects.map(
(jsonString) {
final dynamic parsedJson = json.decode(jsonString);
return ConvertedSimpleObject.fromJson(parsedJson);
@@ -170,7 +170,7 @@ class ConvertedSimplePage extends StatelessWidget {
class ConvertedComplexPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
List<ConvertedComplexObject> objects = JsonStrings.complexObjects.map(
var objects = JsonStrings.complexObjects.map(
(jsonString) {
final dynamic parsedJson = json.decode(jsonString);
return ConvertedComplexObject.fromJson(parsedJson);
@@ -212,7 +212,7 @@ class ConvertedListPage extends StatelessWidget {
class SerializableSimplePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
List<SerializableSimpleObject> objects = JsonStrings.simpleObjects.map(
var objects = JsonStrings.simpleObjects.map(
(jsonString) {
final dynamic parsedJson = json.decode(jsonString);
return SerializableSimpleObject.fromJson(parsedJson);
@@ -233,7 +233,7 @@ class SerializableSimplePage extends StatelessWidget {
class SerializableComplexPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
List<SerializableComplexObject> objects = JsonStrings.complexObjects.map(
var objects = JsonStrings.complexObjects.map(
(jsonString) {
final dynamic parsedJson = json.decode(jsonString);
return SerializableComplexObject.fromJson(parsedJson);
@@ -275,7 +275,7 @@ class SerializableListPage extends StatelessWidget {
class BuiltSimplePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
List<BuiltSimpleObject> objects = JsonStrings.simpleObjects.map(
var objects = JsonStrings.simpleObjects.map(
(jsonString) {
final dynamic parsedJson = json.decode(jsonString);
return serializers.deserializeWith(
@@ -297,7 +297,7 @@ class BuiltSimplePage extends StatelessWidget {
class BuiltComplexPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
List<BuiltComplexObject> objects = JsonStrings.complexObjects.map(
var objects = JsonStrings.complexObjects.map(
(jsonString) {
final dynamic parsedJson = json.decode(jsonString);
return serializers.deserializeWith(

View File

@@ -100,7 +100,7 @@ class SimpleObjectViewList extends StatelessWidget {
Widget build(BuildContext context) {
final widgets = <Widget>[];
for (int i = 0; i < simpleObjects.length; i++) {
for (var i = 0; i < simpleObjects.length; i++) {
widgets.addAll([
Text(
'SimpleObject $i:',
@@ -274,7 +274,7 @@ class ComplexObjectViewList extends StatelessWidget {
Widget build(BuildContext context) {
final widgets = <Widget>[];
for (int i = 0; i < complexObjects.length; i++) {
for (var i = 0; i < complexObjects.length; i++) {
widgets.addAll([
Text(
'Complex Object $i:',

View File

@@ -7,14 +7,14 @@ packages:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
version: "3.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "0.39.6"
version: "0.39.8"
archive:
dependency: transitive
description:
@@ -70,21 +70,21 @@ packages:
name: build_resolvers
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.4"
version: "1.3.7"
build_runner:
dependency: "direct dev"
description:
name: build_runner
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
version: "1.9.0"
build_runner_core:
dependency: transitive
description:
name: build_runner_core
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.0"
version: "5.1.0"
built_collection:
dependency: "direct main"
description:
@@ -98,14 +98,14 @@ packages:
name: built_value
url: "https://pub.dartlang.org"
source: hosted
version: "7.0.9"
version: "7.1.0"
built_value_generator:
dependency: "direct dev"
description:
name: built_value_generator
url: "https://pub.dartlang.org"
source: hosted
version: "7.0.9"
version: "7.1.0"
charcode:
dependency: transitive
description:
@@ -161,7 +161,7 @@ packages:
name: dart_style
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.4"
version: "1.3.6"
fixnum:
dependency: transitive
description:
@@ -290,7 +290,7 @@ packages:
name: node_io
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1+2"
version: "1.1.0"
package_config:
dependency: transitive
description:
@@ -449,7 +449,7 @@ packages:
name: watcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.7+14"
version: "0.9.7+15"
web_socket_channel:
dependency: transitive
description:
@@ -470,6 +470,6 @@ packages:
name: yaml
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
version: "2.2.1"
sdks:
dart: ">=2.7.0 <3.0.0"

View File

@@ -18,7 +18,7 @@ dev_dependencies:
build_runner: ^1.7.2
built_value_generator: ^7.0.4
json_serializable: ^3.2.5
pedantic: ^1.8.0+1
pedantic: ^1.9.0
flutter:
uses-material-design: true

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'],