backToInitial static method

Future<void> backToInitial({
  1. dynamic result,
  2. int? tabIndex,
  3. String? tabName,
})

Implementation

static Future<void> backToInitial({dynamic result, int? tabIndex, String? tabName}) async {
  // pop to initial route in stack
  await _stackRouter?.backToInitial(result: result);

  // optional: pop to specific route in tab
  if (tabName != null || tabIndex != null) {
    int? newTabIndex;
    if (tabName != null) {
      newTabIndex = await _tabRouter?.currentState?.setNewRoute(tabName);
    }
    if (tabIndex != null && newTabIndex == null) {
      newTabIndex = await _tabRouter?.currentState?.setNewIndex(tabIndex);
    }
  }
}