load method

  1. @override
Future<Map<String, dynamic>> load ()
override

Implementation

@override
Future<Map<String, dynamic>> load() async {
  final file = await stateFile;
  if (await file.exists()) {
    try {
      return json.decode(await file.readAsString());
    } catch (e, st) {
      if (clearDataOnLoadError) {
        await clear();
      }
      FlutterError.reportError(FlutterErrorDetails(
        exception: e,
        stack: st,
        library: 'state_persistence',
        silent: true,
      ));
    }
  }
  return Map.from(initialData);
}