Skip to content

Commit

Permalink
Merge pull request #121 from giuliaries/main
Browse files Browse the repository at this point in the history
Dynamic access the enum
  • Loading branch information
incrediblezayed authored Aug 18, 2024
2 parents a8efbef + a62c500 commit 175766c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions lib/src/utils/mime_types.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'package:collection/collection.dart';

///[MimeType] is an enum for adding filetype for HTML Blob
enum MimeType {
///[avi] for .avi extension
Expand Down Expand Up @@ -137,4 +139,8 @@ enum MimeType {
final String name;
final String type;
const MimeType({required this.name, required this.type});

static MimeType? get(String? name) {
return MimeType.values.firstWhereOrNull((e) => e.name == name);
}
}
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ packages:
source: hosted
version: "1.1.1"
collection:
dependency: transitive
dependency: "direct main"
description:
name: collection
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dependencies:
path_provider_windows: ^2.2.1
path_provider_linux: ^2.2.1
dio: ^5.4.3+1
collection: ^1.18.0
web: ^1.0.0

dev_dependencies:
Expand Down

0 comments on commit 175766c

Please sign in to comment.