write method

  1. @override
Future<JobDone> write(
  1. String boxName,
  2. String key,
  3. dynamic value
)
override

Implementation

@override
Future<JobDone> write(String boxName, String key, dynamic value) async {
  try {
    final box = await openBox(boxName);
    if (box.containsKey(key)) {
      throw const DatabaseBridgeException(error: 'duplicate_key');
    }
    await box.put(key, value);
    return const JobDone();
  } catch (e) {
    throw DatabaseBridgeException(error: e);
  }
}