create method

void create([
  1. RouteInformation? routeInformation,
  2. BeamParameters? beamParameters,
  3. bool tryPoppingHistory = true
])

Creates the state and adds the routeInformation to history. This is called only once during the lifetime of BeamLocation.

See createState and addToHistory.

Implementation

void create([
  RouteInformation? routeInformation,
  BeamParameters? beamParameters,
  bool tryPoppingHistory = true,
]) {
  if (!isCurrent) {
    try {
      disposeState();
    } catch (e) {
      //
    }
    history.clear();
  }
  state = createState(
    routeInformation ?? RouteInformation(uri: Uri.parse('/')),
  );
  addToHistory(
    state.routeInformation,
    beamParameters ?? const BeamParameters(),
    tryPoppingHistory,
  );
}