system_navigation.dart 724 Bytes
Newer Older
Ian Hickson's avatar
Ian Hickson committed
1
// Copyright 2014 The Flutter Authors. All rights reserved.
2 3 4 5 6 7 8 9
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:async';
import 'package:flutter/services.dart';
import 'test_step.dart';

Future<TestStepResult> systemNavigatorPop() {
10
  const BasicMessageChannel<String> channel = BasicMessageChannel<String>(
11
    'navigation-test',
12
    StringCodec(),
13 14
  );

15
  final Completer<TestStepResult> completer = Completer<TestStepResult>();
16 17 18

  channel.setMessageHandler((String message) async {
    completer.complete(
19
        const TestStepResult('System navigation pop', '', TestStatus.ok));
20 21 22 23 24
    return '';
  });
  SystemNavigator.pop();
  return completer.future;
}