mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
Upgrading samples to flutter_lints, part 1 of n (#804)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
include: package:pedantic/analysis_options.1.9.0.yaml
|
||||
include: package:flutter_lints/flutter.yaml
|
||||
|
||||
analyzer:
|
||||
exclude:
|
||||
@@ -10,25 +10,14 @@ analyzer:
|
||||
|
||||
linter:
|
||||
rules:
|
||||
- avoid_types_on_closure_parameters
|
||||
- avoid_void_async
|
||||
- await_only_futures
|
||||
- camel_case_types
|
||||
- cancel_subscriptions
|
||||
- close_sinks
|
||||
- constant_identifier_names
|
||||
- control_flow_in_finally
|
||||
- directives_ordering
|
||||
- empty_statements
|
||||
- hash_and_equals
|
||||
- implementation_imports
|
||||
- non_constant_identifier_names
|
||||
- package_api_docs
|
||||
- package_names
|
||||
- package_prefixed_library_names
|
||||
- test_types_in_equals
|
||||
- throw_in_finally
|
||||
- unnecessary_brace_in_string_interps
|
||||
- unnecessary_getters_setters
|
||||
- unnecessary_new
|
||||
- unnecessary_statements
|
||||
avoid_types_on_closure_parameters: true
|
||||
avoid_void_async: true
|
||||
cancel_subscriptions: true
|
||||
close_sinks: true
|
||||
directives_ordering: true
|
||||
package_api_docs: true
|
||||
package_prefixed_library_names: true
|
||||
test_types_in_equals: true
|
||||
throw_in_finally: true
|
||||
unnecessary_statements: true
|
||||
use_key_in_widget_constructors: false
|
||||
|
||||
@@ -17,9 +17,10 @@ class _$BuiltComplexObjectSerializer
|
||||
final String wireName = 'BuiltComplexObject';
|
||||
|
||||
@override
|
||||
Iterable<Object> serialize(Serializers serializers, BuiltComplexObject object,
|
||||
Iterable<Object?> serialize(
|
||||
Serializers serializers, BuiltComplexObject object,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = <Object>[];
|
||||
final result = <Object?>[];
|
||||
Object? value;
|
||||
value = object.aString;
|
||||
if (value != null) {
|
||||
@@ -85,7 +86,7 @@ class _$BuiltComplexObjectSerializer
|
||||
|
||||
@override
|
||||
BuiltComplexObject deserialize(
|
||||
Serializers serializers, Iterable<Object> serialized,
|
||||
Serializers serializers, Iterable<Object?> serialized,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = new BuiltComplexObjectBuilder();
|
||||
|
||||
@@ -93,7 +94,7 @@ class _$BuiltComplexObjectSerializer
|
||||
while (iterator.moveNext()) {
|
||||
final key = iterator.current as String;
|
||||
iterator.moveNext();
|
||||
final Object value = iterator.current;
|
||||
final Object? value = iterator.current;
|
||||
switch (key) {
|
||||
case 'aString':
|
||||
result.aString = serializers.deserialize(value,
|
||||
@@ -109,31 +110,31 @@ class _$BuiltComplexObjectSerializer
|
||||
break;
|
||||
case 'anObject':
|
||||
result.anObject.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(BuiltSimpleObject))
|
||||
specifiedType: const FullType(BuiltSimpleObject))!
|
||||
as BuiltSimpleObject);
|
||||
break;
|
||||
case 'aListOfStrings':
|
||||
result.aListOfStrings.replace(serializers.deserialize(value,
|
||||
specifiedType:
|
||||
const FullType(BuiltList, const [const FullType(String)]))
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(String)]))!
|
||||
as BuiltList<Object>);
|
||||
break;
|
||||
case 'aListOfInts':
|
||||
result.aListOfInts.replace(serializers.deserialize(value,
|
||||
specifiedType:
|
||||
const FullType(BuiltList, const [const FullType(int)]))
|
||||
const FullType(BuiltList, const [const FullType(int)]))!
|
||||
as BuiltList<Object>);
|
||||
break;
|
||||
case 'aListOfDoubles':
|
||||
result.aListOfDoubles.replace(serializers.deserialize(value,
|
||||
specifiedType:
|
||||
const FullType(BuiltList, const [const FullType(double)]))
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(double)]))!
|
||||
as BuiltList<Object>);
|
||||
break;
|
||||
case 'aListOfObjects':
|
||||
result.aListOfObjects.replace(serializers.deserialize(value,
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(BuiltSimpleObject)]))
|
||||
BuiltList, const [const FullType(BuiltSimpleObject)]))!
|
||||
as BuiltList<Object>);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -17,9 +17,9 @@ class _$BuiltSimpleObjectSerializer
|
||||
final String wireName = 'BuiltSimpleObject';
|
||||
|
||||
@override
|
||||
Iterable<Object> serialize(Serializers serializers, BuiltSimpleObject object,
|
||||
Iterable<Object?> serialize(Serializers serializers, BuiltSimpleObject object,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = <Object>[];
|
||||
final result = <Object?>[];
|
||||
Object? value;
|
||||
value = object.aString;
|
||||
if (value != null) {
|
||||
@@ -70,7 +70,7 @@ class _$BuiltSimpleObjectSerializer
|
||||
|
||||
@override
|
||||
BuiltSimpleObject deserialize(
|
||||
Serializers serializers, Iterable<Object> serialized,
|
||||
Serializers serializers, Iterable<Object?> serialized,
|
||||
{FullType specifiedType = FullType.unspecified}) {
|
||||
final result = new BuiltSimpleObjectBuilder();
|
||||
|
||||
@@ -78,7 +78,7 @@ class _$BuiltSimpleObjectSerializer
|
||||
while (iterator.moveNext()) {
|
||||
final key = iterator.current as String;
|
||||
iterator.moveNext();
|
||||
final Object value = iterator.current;
|
||||
final Object? value = iterator.current;
|
||||
switch (key) {
|
||||
case 'aString':
|
||||
result.aString = serializers.deserialize(value,
|
||||
@@ -94,20 +94,20 @@ class _$BuiltSimpleObjectSerializer
|
||||
break;
|
||||
case 'aListOfStrings':
|
||||
result.aListOfStrings.replace(serializers.deserialize(value,
|
||||
specifiedType:
|
||||
const FullType(BuiltList, const [const FullType(String)]))
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(String)]))!
|
||||
as BuiltList<Object>);
|
||||
break;
|
||||
case 'aListOfInts':
|
||||
result.aListOfInts.replace(serializers.deserialize(value,
|
||||
specifiedType:
|
||||
const FullType(BuiltList, const [const FullType(int)]))
|
||||
const FullType(BuiltList, const [const FullType(int)]))!
|
||||
as BuiltList<Object>);
|
||||
break;
|
||||
case 'aListOfDoubles':
|
||||
result.aListOfDoubles.replace(serializers.deserialize(value,
|
||||
specifiedType:
|
||||
const FullType(BuiltList, const [const FullType(double)]))
|
||||
specifiedType: const FullType(
|
||||
BuiltList, const [const FullType(double)]))!
|
||||
as BuiltList<Object>);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3,22 +3,22 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
abstract class JsonStrings {
|
||||
static final String listOfInts = '[1, 2, 3]';
|
||||
static const listOfInts = '[1, 2, 3]';
|
||||
|
||||
static final String listOfDoubles = '[1.0, 2.0, 3.0]';
|
||||
static const listOfDoubles = '[1.0, 2.0, 3.0]';
|
||||
|
||||
static final String listOfStrings = '["one", "two", "three"]';
|
||||
static const listOfStrings = '["one", "two", "three"]';
|
||||
|
||||
static final String listOfDynamics = '[1, "two", 3.0]';
|
||||
static const listOfDynamics = '[1, "two", 3.0]';
|
||||
|
||||
static final String mapOfDynamics = '''
|
||||
static const mapOfDynamics = '''
|
||||
{
|
||||
"anInt": 1,
|
||||
"aString": "Blah, blah, blah.",
|
||||
"aDouble": 1.0
|
||||
}''';
|
||||
|
||||
static final String listOfSimpleObjects = '''
|
||||
static const listOfSimpleObjects = '''
|
||||
[
|
||||
{
|
||||
"aString": "Blah, blah, blah.",
|
||||
@@ -97,7 +97,7 @@ abstract class JsonStrings {
|
||||
]
|
||||
''';
|
||||
|
||||
static final List<String> simpleObjects = [
|
||||
static final simpleObjects = [
|
||||
'''
|
||||
{
|
||||
"aString": "Blah, blah, blah.",
|
||||
@@ -184,7 +184,7 @@ abstract class JsonStrings {
|
||||
}''',
|
||||
];
|
||||
|
||||
static final List<String> complexObjects = [
|
||||
static final complexObjects = [
|
||||
'''
|
||||
{
|
||||
"aString": "Blah, blah, blah.",
|
||||
|
||||
@@ -15,13 +15,13 @@ class MyApp extends StatelessWidget {
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.blue,
|
||||
),
|
||||
home: MyHomePage(),
|
||||
home: const MyHomePage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MyHomePage extends StatelessWidget {
|
||||
MyHomePage({Key? key}) : super(key: key);
|
||||
const MyHomePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:jsonexample/utils.dart';
|
||||
|
||||
class SimpleObjectView extends StatelessWidget {
|
||||
SimpleObjectView(dynamic obj) : simpleObject = obj;
|
||||
const SimpleObjectView(this.simpleObject);
|
||||
|
||||
final dynamic simpleObject;
|
||||
|
||||
@@ -93,7 +93,7 @@ class SimpleObjectView extends StatelessWidget {
|
||||
}
|
||||
|
||||
class SimpleObjectViewList extends StatelessWidget {
|
||||
SimpleObjectViewList(List<dynamic> objects) : simpleObjects = objects;
|
||||
const SimpleObjectViewList(this.simpleObjects);
|
||||
|
||||
final List<dynamic> simpleObjects;
|
||||
|
||||
@@ -125,7 +125,7 @@ class SimpleObjectViewList extends StatelessWidget {
|
||||
class ComplexObjectView extends StatelessWidget {
|
||||
final dynamic complexObject;
|
||||
|
||||
ComplexObjectView(dynamic obj) : complexObject = obj;
|
||||
const ComplexObjectView(this.complexObject);
|
||||
|
||||
List<Widget> _generateSimpleObjectWidgets(Iterable<dynamic>? simpleObjects) {
|
||||
if (simpleObjects == null) {
|
||||
@@ -267,7 +267,7 @@ class ComplexObjectView extends StatelessWidget {
|
||||
}
|
||||
|
||||
class ComplexObjectViewList extends StatelessWidget {
|
||||
ComplexObjectViewList(List<dynamic> objects) : complexObjects = objects;
|
||||
const ComplexObjectViewList(this.complexObjects);
|
||||
|
||||
final List<dynamic> complexObjects;
|
||||
|
||||
|
||||
@@ -7,21 +7,21 @@ packages:
|
||||
name: _fe_analyzer_shared
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "12.0.0"
|
||||
version: "22.0.0"
|
||||
analyzer:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: analyzer
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.40.6"
|
||||
version: "1.7.1"
|
||||
args:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: args
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.6.0"
|
||||
version: "2.1.1"
|
||||
async:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -42,63 +42,63 @@ packages:
|
||||
name: build
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.6.2"
|
||||
version: "2.0.2"
|
||||
build_config:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build_config
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.4.5"
|
||||
version: "1.0.0"
|
||||
build_daemon:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build_daemon
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.7"
|
||||
version: "3.0.0"
|
||||
build_resolvers:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build_resolvers
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.5.3"
|
||||
version: "2.0.3"
|
||||
build_runner:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: build_runner
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.11.1"
|
||||
version: "2.0.4"
|
||||
build_runner_core:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build_runner_core
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "6.1.7"
|
||||
version: "7.0.0"
|
||||
built_collection:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: built_collection
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "5.0.0-nullsafety.0"
|
||||
version: "5.0.0"
|
||||
built_value:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: built_value
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "8.0.0-nullsafety.0"
|
||||
version: "8.0.6"
|
||||
built_value_generator:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: built_value_generator
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "8.0.0-nullsafety.0"
|
||||
version: "8.0.6"
|
||||
characters:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -119,14 +119,14 @@ packages:
|
||||
name: checked_yaml
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
version: "2.0.1"
|
||||
cli_util:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: cli_util
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.0"
|
||||
version: "0.3.0"
|
||||
clock:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -140,7 +140,7 @@ packages:
|
||||
name: code_builder
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.6.0"
|
||||
version: "4.0.0"
|
||||
collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -154,21 +154,21 @@ packages:
|
||||
name: convert
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
version: "3.0.0"
|
||||
crypto:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: crypto
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.5"
|
||||
version: "3.0.1"
|
||||
dart_style:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: dart_style
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.10"
|
||||
version: "2.0.1"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -182,7 +182,7 @@ packages:
|
||||
name: file
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "5.2.1"
|
||||
version: "6.1.1"
|
||||
fixnum:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -195,53 +195,60 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: flutter_lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.3"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
frontend_server_client:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: frontend_server_client
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
glob:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: glob
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "2.0.1"
|
||||
graphs:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: graphs
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.0"
|
||||
version: "2.0.0"
|
||||
http_multi_server:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: http_multi_server
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.2.0"
|
||||
version: "3.0.1"
|
||||
http_parser:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: http_parser
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.1.4"
|
||||
intl:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: intl
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.16.1"
|
||||
version: "4.0.0"
|
||||
io:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: io
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.3.4"
|
||||
version: "1.0.0"
|
||||
js:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -255,21 +262,28 @@ packages:
|
||||
name: json_annotation
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.0.0-nullsafety.0"
|
||||
version: "4.0.1"
|
||||
json_serializable:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: json_serializable
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.0.0-nullsafety.0"
|
||||
version: "4.1.3"
|
||||
lints:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
logging:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: logging
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
version: "1.0.1"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -291,27 +305,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
node_interop:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: node_interop
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.1"
|
||||
node_io:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: node_io
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
package_config:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: package_config
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.9.3"
|
||||
version: "2.0.0"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -320,54 +320,54 @@ packages:
|
||||
source: hosted
|
||||
version: "1.8.0"
|
||||
pedantic:
|
||||
dependency: "direct dev"
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pedantic
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.10.0"
|
||||
version: "1.11.0"
|
||||
pool:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pool
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.4.0"
|
||||
version: "1.5.0"
|
||||
pub_semver:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pub_semver
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.4.4"
|
||||
version: "2.0.0"
|
||||
pubspec_parse:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pubspec_parse
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.7"
|
||||
version: "1.0.0"
|
||||
quiver:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: quiver
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.5"
|
||||
version: "3.0.1"
|
||||
shelf:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shelf
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.7.9"
|
||||
version: "1.1.4"
|
||||
shelf_web_socket:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: shelf_web_socket
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.4"
|
||||
version: "1.0.1"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
@@ -379,7 +379,7 @@ packages:
|
||||
name: source_gen
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.9.10+1"
|
||||
version: "1.0.1"
|
||||
source_span:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -407,7 +407,7 @@ packages:
|
||||
name: stream_transform
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "2.0.0"
|
||||
string_scanner:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -435,7 +435,7 @@ packages:
|
||||
name: timing
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.1+3"
|
||||
version: "1.0.0"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -456,20 +456,20 @@ packages:
|
||||
name: watcher
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.9.7+15"
|
||||
version: "1.0.0"
|
||||
web_socket_channel:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: web_socket_channel
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "2.1.0"
|
||||
yaml:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: yaml
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.2.1"
|
||||
version: "3.1.0"
|
||||
sdks:
|
||||
dart: ">=2.12.0 <3.0.0"
|
||||
|
||||
@@ -2,12 +2,12 @@ name: jsonexample
|
||||
description: A demonstration of JSON parsing
|
||||
|
||||
environment:
|
||||
sdk: '>=2.12.0-0 <3.0.0'
|
||||
sdk: ">=2.12.0 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
json_annotation: ^4.0.0-0
|
||||
built_collection: ^5.0.0-0
|
||||
built_value: ^8.0.0-0
|
||||
json_annotation: ^4.0.0
|
||||
built_collection: ^5.0.0
|
||||
built_value: ^8.0.0
|
||||
|
||||
flutter:
|
||||
sdk: flutter
|
||||
@@ -15,10 +15,10 @@ dependencies:
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
build_runner: ^1.11.1
|
||||
built_value_generator: ^8.0.0-0
|
||||
json_serializable: ^4.0.0-0
|
||||
pedantic: ^1.9.0
|
||||
build_runner: ^2.0.4
|
||||
built_value_generator: ^8.0.0
|
||||
json_serializable: ^4.0.0
|
||||
flutter_lints: ^1.0.0
|
||||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
|
||||
@@ -325,7 +325,7 @@ void main() {
|
||||
group('BuiltComplexObject unit tests', () {
|
||||
test('Typical object is converted correctly', () {
|
||||
final complexObject = serializers.deserializeWith(
|
||||
BuiltComplexObject.serializer, typicalObjectJson);
|
||||
BuiltComplexObject.serializer, typicalObjectJson)!;
|
||||
|
||||
expect(complexObject.aString, 'Blah, blah, blah.');
|
||||
expect(complexObject.anInt, 1);
|
||||
@@ -354,8 +354,8 @@ void main() {
|
||||
});
|
||||
|
||||
test('Empty object results in null fields', () {
|
||||
final complexObject =
|
||||
serializers.deserializeWith(BuiltComplexObject.serializer, emptyJson);
|
||||
final complexObject = serializers.deserializeWith(
|
||||
BuiltComplexObject.serializer, emptyJson)!;
|
||||
|
||||
expect(complexObject.aString, isNull);
|
||||
expect(complexObject.anInt, isNull);
|
||||
@@ -369,7 +369,7 @@ void main() {
|
||||
|
||||
test('Empty simple objects result in instances with null fields', () {
|
||||
final complexObject = serializers.deserializeWith(
|
||||
BuiltComplexObject.serializer, emptySimpleObjectsJson);
|
||||
BuiltComplexObject.serializer, emptySimpleObjectsJson)!;
|
||||
|
||||
expect(complexObject.aString, 'Blah, blah, blah.');
|
||||
expect(complexObject.anInt, 1);
|
||||
@@ -397,7 +397,7 @@ void main() {
|
||||
|
||||
test('Unexpected properties are ignored', () {
|
||||
final complexObject = serializers.deserializeWith(
|
||||
BuiltComplexObject.serializer, unexpectedPropertiesJson);
|
||||
BuiltComplexObject.serializer, unexpectedPropertiesJson)!;
|
||||
|
||||
expect(complexObject.aString, 'Blah, blah, blah.');
|
||||
expect(complexObject.anInt, 1);
|
||||
|
||||
@@ -146,7 +146,7 @@ void main() {
|
||||
group('BuiltSimpleObject unit tests', () {
|
||||
test('Typical object is converted correctly', () {
|
||||
final simpleObject = serializers.deserializeWith(
|
||||
BuiltSimpleObject.serializer, typicalObjectJson);
|
||||
BuiltSimpleObject.serializer, typicalObjectJson)!;
|
||||
|
||||
expect(simpleObject, isNotNull);
|
||||
expect(simpleObject.aString, 'Blah, blah, blah.');
|
||||
@@ -159,7 +159,7 @@ void main() {
|
||||
|
||||
test('Empty object results in null fields', () {
|
||||
final simpleObject =
|
||||
serializers.deserializeWith(BuiltSimpleObject.serializer, emptyJson);
|
||||
serializers.deserializeWith(BuiltSimpleObject.serializer, emptyJson)!;
|
||||
|
||||
expect(simpleObject, isNotNull);
|
||||
expect(simpleObject.aString, isNull);
|
||||
@@ -172,7 +172,7 @@ void main() {
|
||||
|
||||
test('Empty lists are converted as empty lists', () {
|
||||
final simpleObject = serializers.deserializeWith(
|
||||
BuiltSimpleObject.serializer, emptyListJson);
|
||||
BuiltSimpleObject.serializer, emptyListJson)!;
|
||||
|
||||
expect(simpleObject, isNotNull);
|
||||
expect(simpleObject.aString, 'Blah, blah, blah.');
|
||||
@@ -185,7 +185,7 @@ void main() {
|
||||
|
||||
test('Unexpected properties are ignored', () {
|
||||
final simpleObject = serializers.deserializeWith(
|
||||
BuiltSimpleObject.serializer, unexpectedPropertiesJson);
|
||||
BuiltSimpleObject.serializer, unexpectedPropertiesJson)!;
|
||||
|
||||
expect(simpleObject, isNotNull);
|
||||
expect(simpleObject.aString, 'Blah, blah, blah.');
|
||||
|
||||
@@ -11,7 +11,7 @@ import 'package:jsonexample/widgets.dart';
|
||||
void main() {
|
||||
group('SimpleObjectView widget test', () {
|
||||
testWidgets('Typical object is displayed correctly', (tester) async {
|
||||
final simpleObject = ConvertedSimpleObject(
|
||||
const simpleObject = ConvertedSimpleObject(
|
||||
aString: 'Blah, blah, blah',
|
||||
anInt: 1,
|
||||
aDouble: 1.0,
|
||||
@@ -21,7 +21,7 @@ void main() {
|
||||
);
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: SimpleObjectView(simpleObject),
|
||||
),
|
||||
);
|
||||
@@ -35,7 +35,7 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('Empty lists are displayed as brackets', (tester) async {
|
||||
final simpleObject = ConvertedSimpleObject(
|
||||
const simpleObject = ConvertedSimpleObject(
|
||||
aString: 'Blah, blah, blah',
|
||||
anInt: 1,
|
||||
aDouble: 1.0,
|
||||
@@ -45,7 +45,7 @@ void main() {
|
||||
);
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: SimpleObjectView(simpleObject),
|
||||
),
|
||||
);
|
||||
@@ -54,7 +54,7 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('Null values are displayed as NULL', (tester) async {
|
||||
final simpleObject = ConvertedSimpleObject(
|
||||
const simpleObject = ConvertedSimpleObject(
|
||||
aString: null,
|
||||
anInt: null,
|
||||
aDouble: null,
|
||||
@@ -64,7 +64,7 @@ void main() {
|
||||
);
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: SimpleObjectView(simpleObject),
|
||||
),
|
||||
);
|
||||
@@ -75,7 +75,7 @@ void main() {
|
||||
|
||||
group('ComplexObjectView widget test', () {
|
||||
testWidgets('Typical object is displayed correctly', (tester) async {
|
||||
final complexObject = ConvertedComplexObject(
|
||||
const complexObject = ConvertedComplexObject(
|
||||
aString: 'Blah, blah, blah',
|
||||
anInt: 1,
|
||||
aDouble: 1.0,
|
||||
@@ -119,7 +119,7 @@ void main() {
|
||||
);
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: ComplexObjectView(complexObject),
|
||||
),
|
||||
);
|
||||
@@ -142,7 +142,7 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('Empty lists are displayed as brackets', (tester) async {
|
||||
final complexObject = ConvertedComplexObject(
|
||||
const complexObject = ConvertedComplexObject(
|
||||
aString: 'Blah, blah, blah',
|
||||
anInt: 1,
|
||||
aDouble: 1.0,
|
||||
@@ -161,7 +161,7 @@ void main() {
|
||||
);
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: ComplexObjectView(complexObject),
|
||||
),
|
||||
);
|
||||
@@ -170,7 +170,7 @@ void main() {
|
||||
});
|
||||
|
||||
testWidgets('Null values are displayed as NULL', (tester) async {
|
||||
final complexObject = ConvertedComplexObject(
|
||||
const complexObject = ConvertedComplexObject(
|
||||
aString: null,
|
||||
anInt: null,
|
||||
aDouble: null,
|
||||
@@ -182,7 +182,7 @@ void main() {
|
||||
);
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
const MaterialApp(
|
||||
home: ComplexObjectView(complexObject),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user