1
0
mirror of https://github.com/flutter/samples.git synced 2026-04-02 09:43:05 +00:00

Add analysis_options, format and fix up (#104)

This commit is contained in:
Brett Morgan
2019-07-03 06:34:38 +10:00
committed by GitHub
parent bd9b18c2bf
commit 52d85c793e
11 changed files with 81 additions and 43 deletions

View File

@@ -40,6 +40,7 @@ abstract class BuiltComplexObject
BuiltComplexObject._();
factory BuiltComplexObject([updates(BuiltComplexObjectBuilder b)]) =
factory BuiltComplexObject(
[void Function(BuiltComplexObjectBuilder) updates]) =
_$BuiltComplexObject;
}

View File

@@ -33,6 +33,6 @@ abstract class BuiltSimpleObject
BuiltSimpleObject._();
factory BuiltSimpleObject([updates(BuiltSimpleObjectBuilder b)]) =
factory BuiltSimpleObject([void Function(BuiltSimpleObjectBuilder) updates]) =
_$BuiltSimpleObject;
}

View File

@@ -29,24 +29,27 @@ class ConvertedComplexObject {
if (json == null) return null;
return ConvertedComplexObject(
aString: json['aString'],
anInt: json['anInt'],
aDouble: json['aDouble'],
aString: json['aString'] as String,
anInt: json['anInt'] as int,
aDouble: json['aDouble'] as double,
anObject: json['anObject'] != null
? ConvertedSimpleObject.fromJson(json['anObject'])
? ConvertedSimpleObject.fromJson(
json['anObject'] as Map<String, dynamic>)
: null,
aListOfStrings: json['aListOfStrings'] != null
? List<String>.from(json['aListOfStrings'])
? List<String>.from(json['aListOfStrings'] as Iterable<dynamic>)
: null,
aListOfInts: json['aListOfInts'] != null
? List<int>.from(json['aListOfInts'])
? List<int>.from(json['aListOfInts'] as Iterable<dynamic>)
: null,
aListOfDoubles: json['aListOfDoubles'] != null
? List<double>.from(json['aListOfDoubles'])
? List<double>.from(json['aListOfDoubles'] as Iterable<dynamic>)
: null,
aListOfObjects: json['aListOfObjects'] != null
? List<ConvertedSimpleObject>.from(json['aListOfObjects']
.map((o) => ConvertedSimpleObject.fromJson(o)))
? List<ConvertedSimpleObject>.from((json['aListOfObjects']
as Iterable<dynamic>)
.map<dynamic>((dynamic o) =>
ConvertedSimpleObject.fromJson(o as Map<String, dynamic>)))
: null);
}
}

View File

@@ -23,17 +23,17 @@ class ConvertedSimpleObject {
if (json == null) return null;
return ConvertedSimpleObject(
aString: json['aString'],
anInt: json['anInt'],
aDouble: json['aDouble'],
aString: json['aString'] as String,
anInt: json['anInt'] as int,
aDouble: json['aDouble'] as double,
aListOfStrings: json['aListOfStrings'] != null
? List<String>.from(json['aListOfStrings'])
? List<String>.from(json['aListOfStrings'] as Iterable<dynamic>)
: null,
aListOfInts: json['aListOfInts'] != null
? List<int>.from(json['aListOfInts'])
? List<int>.from(json['aListOfInts'] as Iterable<dynamic>)
: null,
aListOfDoubles: json['aListOfDoubles'] != null
? List<double>.from(json['aListOfDoubles'])
? List<double>.from(json['aListOfDoubles'] as Iterable<dynamic>)
: null,
);
}

View File

@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// ignore_for_file: argument_type_not_assignable, strong_mode_implicit_dynamic_parameter, strong_mode_implicit_dynamic_variable
import 'dart:convert';
import 'package:flutter/material.dart';

View File

@@ -58,7 +58,7 @@ class SimpleObjectView extends StatelessWidget {
Text('aListOfStrings:', style: boldStyle),
Text(
prettyPrintList(
simpleObject.aListOfStrings,
simpleObject.aListOfStrings as Iterable<dynamic>,
),
style: localTheme.body1,
),
@@ -68,7 +68,7 @@ class SimpleObjectView extends StatelessWidget {
children: [
Text('aListOfInts:', style: boldStyle),
Text(
prettyPrintList(simpleObject.aListOfInts),
prettyPrintList(simpleObject.aListOfInts as Iterable<dynamic>),
style: localTheme.body1,
),
],
@@ -80,7 +80,7 @@ class SimpleObjectView extends StatelessWidget {
child: Text('aListOfDoubles:', style: boldStyle),
),
Text(
prettyPrintList(simpleObject.aListOfDoubles),
prettyPrintList(simpleObject.aListOfDoubles as Iterable<dynamic>),
style: localTheme.body1,
),
],
@@ -135,7 +135,7 @@ class ComplexObjectView extends StatelessWidget {
];
}
if (simpleObjects.length == 0) {
if (simpleObjects.isEmpty) {
return [
const Padding(
padding: EdgeInsets.symmetric(vertical: 4.0),
@@ -145,7 +145,7 @@ class ComplexObjectView extends StatelessWidget {
}
return simpleObjects
.expand((o) => [
.expand((dynamic o) => [
const SizedBox(height: 4.0),
SimpleObjectView(o),
const SizedBox(height: 4.0),
@@ -213,7 +213,8 @@ class ComplexObjectView extends StatelessWidget {
children: [
Text('aListOfStrings:', style: boldStyle),
Text(
prettyPrintList(complexObject.aListOfStrings),
prettyPrintList(
complexObject.aListOfStrings as Iterable<dynamic>),
style: localTheme.body1,
),
],
@@ -222,7 +223,8 @@ class ComplexObjectView extends StatelessWidget {
children: [
Text('aListOfInts:', style: boldStyle),
Text(
prettyPrintList(complexObject.aListOfInts),
prettyPrintList(
complexObject.aListOfInts as Iterable<dynamic>),
style: localTheme.body1,
),
],
@@ -234,7 +236,8 @@ class ComplexObjectView extends StatelessWidget {
child: Text('aListOfDoubles:', style: boldStyle),
),
Text(
prettyPrintList(complexObject.aListOfDoubles),
prettyPrintList(
complexObject.aListOfDoubles as Iterable<dynamic>),
style: localTheme.body1,
),
],
@@ -251,8 +254,8 @@ class ComplexObjectView extends StatelessWidget {
padding: const EdgeInsets.only(left: 24.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children:
_generateSimpleObjectWidgets(complexObject.aListOfObjects),
children: _generateSimpleObjectWidgets(
complexObject.aListOfObjects as Iterable<dynamic>),
),
),
],