create method

  1. @override
Future<Model> create({
  1. String? wantedId,
})
override

Creates a new entry in the repository.

Implementation

@override
Future<Model> create({String? wantedId}) async {
  final String uniqueId = wantedId ?? _box.values.hashCode.toString();
  final Model newModel = Model(id: uniqueId);

  _box.put(uniqueId, newModel.toJson());

  return newModel;
}