saveModel method

Future<bool> saveModel(
  1. Model model
)

Save Model to Cache and add to Map

Implementation

Future<bool> saveModel(Model model) async {
  if (!model.validate()) {
    return false;
  }
  if (!await CacheHandler.saveCacheObjectToList(
      getCacheId(), model.toCacheObject(), "id")) {
    return false;
  }
  _models[model.getId()] = model;
  return true;
}