create method

Future<QueryResult> create(
  1. Query query,
  2. LazyBox<JSON> box
)

Tries to store queries payload in hive box

Implementation

Future<QueryResult> create(Query query, LazyBox<JSON> box) async {
  final id = query.payload['id'] as String?;
  if (id != null && box.containsKey(id)) {
    return QueryResult.failed(
      query,
      errorMsg: 'Object already exists in hive box',
    );
  }
  return _store(query, box);
}