init method
You don't have to call this method. This is automatically called by the library.
Implementation
Future<void> init() async {
if (!_initialized) {
_initialized = true;
String? historyJson;
historyJson = await tryasync(
// ignore: unnecessary_cast
(() => _persistGet!(_rootContext, 'MOMENTUM_ROUTER_HISTORY')
as Future<String>) as Future<String> Function(),
'[]',
);
var result = historyJson == null
? '[]'
: trycatch(
() => jsonDecode(historyJson!),
'[]',
);
_history = (result as List).map<int>((e) => e as int).toList();
if (_history.isEmpty) {
_history.add(0);
}
}
return;
}