putPosit method

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

Put new key

Implementation

Future<bool> putPosit(
    {required dynamic key,
    bool force = false,
    bool closeDrawer = true}) 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 (_drawerKey.currentState != null &&
        _drawerKey.currentState!.isDrawerOpen &&
        closeDrawer) {
      Navigator.pop(drawerContext!);
    }

    stack.add(screenList[key]!);
    _fragment.sink.add(FullPosit.byPosit(
        posit: stack.last,
        bottom: _getBottom(key: key),
        actions: _getActions(key: key),
        floatingAction: _getFloating(key: key)));

    return true;
  }

  return false;
}