Migrate platform_interaction to null safety (#80621)
This commit is contained in:
parent
0e979a500f
commit
ff54fc6da8
@ -16,7 +16,7 @@ void main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class TestApp extends StatefulWidget {
|
class TestApp extends StatefulWidget {
|
||||||
const TestApp({Key key}) : super(key: key);
|
const TestApp({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_TestAppState createState() => _TestAppState();
|
_TestAppState createState() => _TestAppState();
|
||||||
@ -26,7 +26,7 @@ class _TestAppState extends State<TestApp> {
|
|||||||
static final List<TestStep> steps = <TestStep>[
|
static final List<TestStep> steps = <TestStep>[
|
||||||
() => systemNavigatorPop(),
|
() => systemNavigatorPop(),
|
||||||
];
|
];
|
||||||
Future<TestStepResult> _result;
|
Future<TestStepResult>? _result;
|
||||||
int _step = 0;
|
int _step = 0;
|
||||||
|
|
||||||
void _executeNextStep() {
|
void _executeNextStep() {
|
||||||
|
@ -14,7 +14,7 @@ Future<TestStepResult> systemNavigatorPop() {
|
|||||||
|
|
||||||
final Completer<TestStepResult> completer = Completer<TestStepResult>();
|
final Completer<TestStepResult> completer = Completer<TestStepResult>();
|
||||||
|
|
||||||
channel.setMessageHandler((String message) async {
|
channel.setMessageHandler((String? message) async {
|
||||||
completer.complete(
|
completer.complete(
|
||||||
const TestStepResult('System navigation pop', '', TestStatus.ok));
|
const TestStepResult('System navigation pop', '', TestStatus.ok));
|
||||||
return '';
|
return '';
|
||||||
|
@ -23,12 +23,11 @@ class TestStepResult {
|
|||||||
return const TestStepResult('Executing', nothing, TestStatus.pending);
|
return const TestStepResult('Executing', nothing, TestStatus.pending);
|
||||||
case ConnectionState.done:
|
case ConnectionState.done:
|
||||||
if (snapshot.hasData) {
|
if (snapshot.hasData) {
|
||||||
return snapshot.data;
|
return snapshot.data!;
|
||||||
} else {
|
} else {
|
||||||
final TestStepResult result = snapshot.error as TestStepResult;
|
final Object? result = snapshot.error;
|
||||||
return result;
|
return result! as TestStepResult;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
throw 'Unsupported state ${snapshot.connectionState}';
|
throw 'Unsupported state ${snapshot.connectionState}';
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ name: platform_interaction
|
|||||||
description: Integration test for platform interactions.
|
description: Integration test for platform interactions.
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.0.0-dev.68.0 <3.0.0"
|
sdk: ">=2.12.0 <3.0.0"
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
|
@ -7,7 +7,7 @@ import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
|
|||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
group('channel suite', () {
|
group('channel suite', () {
|
||||||
FlutterDriver driver;
|
late FlutterDriver driver;
|
||||||
|
|
||||||
setUpAll(() async {
|
setUpAll(() async {
|
||||||
driver = await FlutterDriver.connect(printCommunication: true);
|
driver = await FlutterDriver.connect(printCommunication: true);
|
||||||
@ -28,7 +28,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
tearDownAll(() async {
|
tearDownAll(() async {
|
||||||
driver?.close();
|
driver.close();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user