show method

void show({
  1. Object? id,
  2. bool barrierDismissible = false,
})

Shows loader dialog Provide id id if you have multiple loaders and want to close a specific one

Implementation

void show({Object? id, bool barrierDismissible = false}) {
  assert(_key.currentState.isNotNull, 'Tried to show dialog but navigatorState was null. Key was :$_key');
  final navigatorState = _key.currentState!;
  _routes ??= <LoaderRoute>[];
  assert(
    id.isNull || _routes!.where((element) => element.id == id).toList().isEmpty,
    'There is already a loader showing with id: $id',
  );

  final route = LoaderRoute(
    id: id,
    barrierDismissible: barrierDismissible,
    context: navigatorState.context,
    builder: loaderBuilder,
  );

  _routes!.add(route);
  navigatorState.push(route);
}