uploadFile static method
Implementation
static Future<void> uploadFile({
required File file, required String storagePath,
required String mediaId, required String userId,
VoidCallback? onComplete, void Function(double)? onProgress,
}) async {
final key = IdempotencyKey.generate();
_keys[mediaId] = key;
final ref = FirebaseStorage.instance.ref(storagePath);
await ref.putFile(file, SettableMetadata(
customMetadata: {'userId': userId, 'mediaId': mediaId,
'uploadedAt': DateTime.now().toIso8601String()},
));
onComplete?.call();
onProgress?.call(1.0);
_keys.remove(mediaId);
}