putPosit<K> method

Future<bool> putPosit<K>({
  1. required dynamic key,
  2. bool force = false,
  3. bool closeDrawer = true,
  4. K? params,
})

Put new key

Implementation

Future<bool> putPosit<K>(
    {required dynamic key,
    bool force = false,
    bool closeDrawer = true,
    K? params}) async {
  if (_interface != null) {
    if (!force && !await _interface!.onPut()) {
      return false;
    }
  }

  if (force || stack.isEmpty || stack.last.key != key) {
    _onPut(stack.isNotEmpty ? stack.last.key : null, key);

    if (closeDrawer &&
        _drawerKey.currentState != null &&
        _drawerKey.currentState!.isDrawerOpen) {
      Navigator.pop(drawerContext!);
    }

    final _position = FullPosit.byPosit(
        floatingAction: _getFloating(key: key),
        actions: _getActions(key: key),
        bottom: _getBottom(key: key),
        posit: screenList[key]!,
        params: params);

    stack.add(_position);
    _fragment.sink.add(stack.last);

    return true;
  }

  return false;
}