mirror of
https://github.com/flutter/samples.git
synced 2026-03-31 16:55:34 +00:00
Upgrading samples to flutter_lints, part 1 of n (#804)
This commit is contained in:
@@ -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