storeImageWeb function

Future<String?> storeImageWeb(
  1. String key,
  2. Uint8List bytes
)

Implementation

Future<String?> storeImageWeb(String key, Uint8List bytes) async {
  final db = await _getWebDb();
  if (db != null) {
    final tx = db.transaction(_storeName, 'readwrite');
    final store = tx.objectStore(_storeName);
    final blob = html.Blob([bytes]);
    await store.put(blob, key);
    await tx.completed;
    return 'db://$key';
  }
  return null;
}