-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tekartik_app_media] extensionFromMimeType
- Loading branch information
1 parent
7c8e857
commit fb16def
Showing
6 changed files
with
62 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export 'src/mapping.dart' show extensionFromMimeType; | ||
export 'src/mime_type_constant.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import 'package:tekartik_app_media/mime_type.dart'; | ||
|
||
const _mimeTypeExtensions = { | ||
mimeTypeApplicationJson: extensionApplicationJson, | ||
mimeTypeImageJpg: extensionImageJpg, | ||
mimeTypeImagePng: extensionImagePng, | ||
mimeTypeImageWebp: extensionImageWebp, | ||
}; | ||
|
||
/// Get the extension from a mime type | ||
String? extensionFromMimeType(String mimeType) { | ||
return _mimeTypeExtensions[mimeType]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,23 @@ | ||
/// Mime type for application/json | ||
const mimeTypeApplicationJson = 'application/json'; | ||
|
||
/// Extension for json | ||
const extensionApplicationJson = '.json'; | ||
|
||
/// Mime type for jpg | ||
const mimeTypeImageJpg = 'image/jpeg'; | ||
|
||
/// Extension for jpg | ||
const extensionImageJpg = '.jpg'; | ||
|
||
/// Mime type for png | ||
const mimeTypeImagePng = 'image/png'; | ||
|
||
/// Extension for jpg | ||
const extensionImagePng = '.png'; | ||
|
||
/// Mime type for webp | ||
const mimeTypeImageWebp = 'image/webp'; | ||
|
||
/// Extension for webp | ||
const extensionImageWebp = '.webp'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters