Migrate platform_interaction to null safety (#80621)

This commit is contained in:
Abhishek Ghaskata
2021-04-21 20:09:02 +05:30
committed by GitHub
parent 0e979a500f
commit ff54fc6da8
5 changed files with 9 additions and 10 deletions

View File

@@ -16,7 +16,7 @@ void main() {
}
class TestApp extends StatefulWidget {
const TestApp({Key key}) : super(key: key);
const TestApp({Key? key}) : super(key: key);
@override
_TestAppState createState() => _TestAppState();
@@ -26,7 +26,7 @@ class _TestAppState extends State<TestApp> {
static final List<TestStep> steps = <TestStep>[
() => systemNavigatorPop(),
];
Future<TestStepResult> _result;
Future<TestStepResult>? _result;
int _step = 0;
void _executeNextStep() {

View File

@@ -14,7 +14,7 @@ Future<TestStepResult> systemNavigatorPop() {
final Completer<TestStepResult> completer = Completer<TestStepResult>();
channel.setMessageHandler((String message) async {
channel.setMessageHandler((String? message) async {
completer.complete(
const TestStepResult('System navigation pop', '', TestStatus.ok));
return '';

View File

@@ -23,12 +23,11 @@ class TestStepResult {
return const TestStepResult('Executing', nothing, TestStatus.pending);
case ConnectionState.done:
if (snapshot.hasData) {
return snapshot.data;
return snapshot.data!;
} else {
final TestStepResult result = snapshot.error as TestStepResult;
return result;
final Object? result = snapshot.error;
return result! as TestStepResult;
}
break;
default:
throw 'Unsupported state ${snapshot.connectionState}';
}