-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Closed
Labels
Needs AttentionThis issue needs maintainer attention.This issue needs maintainer attention.platform: webIssues / PRs which are specifically for web.Issues / PRs which are specifically for web.plugin: storage
Description
flutterfire/packages/firebase_storage/firebase_storage_web/lib/src/reference_web.dart
Lines 173 to 207 in 7fcdbee
/// Upload a [String] value as a storage object. | |
/// | |
/// Use [PutStringFormat] to correctly encode the string: | |
/// - [PutStringFormat.raw] the string will be encoded in a Base64 format. | |
/// - [PutStringFormat.dataUrl] the string must be in a data url format | |
/// (e.g. "data:text/plain;base64,SGVsbG8sIFdvcmxkIQ=="). If no | |
/// [SettableMetadata.mimeType] is provided as part of the [metadata] | |
/// argument, the [mimeType] will be automatically set. | |
/// - [PutStringFormat.base64] will be encoded as a Base64 string. | |
/// - [PutStringFormat.base64Url] will be encoded as a Base64 string safe URL. | |
@override | |
TaskPlatform putString( | |
String data, | |
PutStringFormat format, [ | |
SettableMetadata? metadata, | |
]) { | |
dynamic _data = data; | |
// The universal package is converting raw to base64, so we need to convert | |
// Any base64 string values into a Uint8List. | |
if (format == PutStringFormat.base64) { | |
_data = base64Decode(data); | |
} | |
return TaskWeb( | |
this, | |
_ref.put( | |
_data, | |
settableMetadataToFbUploadMetadata( | |
_cache.store(metadata), | |
// md5 is computed server-side, so we don't have to unpack a potentially huge Blob. | |
), | |
), | |
); | |
} |
- The casting to
dynamic
is scary - In only one case is the value converted to
Uint8List
– but all calls toput
should be a binary type
Metadata
Metadata
Assignees
Labels
Needs AttentionThis issue needs maintainer attention.This issue needs maintainer attention.platform: webIssues / PRs which are specifically for web.Issues / PRs which are specifically for web.plugin: storage