handleStoredModel method Null safety

Future<void> handleStoredModel()

Handle saving and restoring model from storage

Implementation

Future<void> handleStoredModel() async {
  // Retrieve stored model and update current value
  final storedModel = await storage!.get();
  if (storedModel != null) {
    model(storedModel);
  }

  // Save to storage on each update
  ever(model, (T value) async => await storage!.set(value));
}