Back to Flutter Boost

pushWithResult<T extends Object> method

doc/api/flutter_boost_app/FlutterBoostAppState/pushWithResult.html

5.0.21.3 KB
Original Source

pushWithResult<T extends Object> method

Future<T>pushWithResult<T extends Object>(

  1. String pageName,
  2. {String uniqueId,
  3. Map<String, dynamic> arguments,
  4. bool withContainer,
  5. bool opaque = true}

)

Implementation

Future<T> pushWithResult<T extends Object>(String pageName,
    {String uniqueId,
    Map<String, dynamic> arguments,
    bool withContainer,
    bool opaque = true}) {
  assert(uniqueId == null);
  uniqueId = _createUniqueId(pageName);
  if (withContainer) {
    final completer = Completer<T>();
    final params = CommonParams()
      ..pageName = pageName
      ..uniqueId = uniqueId
      ..opaque = opaque
      ..arguments = arguments ?? <String, dynamic>{};
    nativeRouterApi.pushFlutterRoute(params);
    _pendingResult[uniqueId] = completer;
    return completer.future;
  } else {
    return pushPage(pageName, uniqueId: uniqueId, arguments: arguments);
  }
}