UploadMetadataResolver class

Pure resolver for upload file naming and MIME metadata.

Previously every upload was stored with a hard-coded extension per MediaType (an .m4a became <id>.mp3) and without any contentType, so Firebase Storage served everything as application/octet-stream — browsers downloaded instead of streaming and some players refused the file. These helpers are pure and unit-testable; AppUploadFirestore wires them into the upload calls.

Constructors

UploadMetadataResolver()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

contentTypeForAppMediaType(AppMediaType type) → String
MIME type for a release item of type. Non-file kinds (posts, polls, youtube references) also fall back to octet-stream.
contentTypeForExtension(String extension) → String
MIME type for extension (with or without leading dot, any case). Falls back to application/octet-stream so metadata is never null.
defaultExtensionFor(MediaType mediaType) → String
Historical default extension per MediaType (kept for storage-path backwards compatibility when the source file extension is unknown).
extensionFromPath(String path) → String?
Extracts the extension (with dot, lower-cased) from path when it is a known media extension; returns null otherwise.
resolveBytesExtension(List<int> bytes, MediaType mediaType) → String
Binary uploads have no source path. Preserve PNG output while retaining legacy defaults for other formats/callers (repository API stays unchanged).
resolveExtension({String? filePath, required MediaType mediaType}) → String
Extension to store the file under: the real one from filePath when it is a known media type, otherwise the historical default for mediaType.