mime icon indicating copy to clipboard operation
mime copied to clipboard

provide better defaults for mimetype to extension mapping

Open mx1up opened this issue 2 years ago • 8 comments

based off pr #15 , afterwards I realized in the meantime mimeFromExtension had already been added 🙄 but without defaults. I went ahead anyway since @kevmoo indicated PR's are still welcome. So this PR mainly adds the defaults and custom error handling (orElse and nullable version), while maintaining backwards compatibility.

example default: image/jpeg now nicely maps to "jpg" instead of "jpe"

I copied firstWhereOrNull from the collection package to avoid a dependency.

fixes #55 fixes #13

Edit: removed collection dependency

mx1up avatar Jan 16 '23 14:01 mx1up

@kevmoo , @natebosch could you have a look please? 🙏

mx1up avatar Jan 27 '23 13:01 mx1up

@lrhn I applied all your suggestions, please have another look

mx1up avatar Dec 13 '23 18:12 mx1up

Looks fine to me. Could probably tweak the documentation phrasing a little, but that's a never-ending search for perfection, we can always iterate on that.

@natebosch WDYT?

lrhn avatar Dec 13 '23 19:12 lrhn

thanks!

about documentation: feel free to make suggestions, love to improve.

I just noticed I forgot to remove some part of the documentation about addMimeType, will do it now

mx1up avatar Dec 13 '23 19:12 mx1up

removed addMimeType from documentation

mx1up avatar Dec 13 '23 19:12 mx1up

@natebosch @lrhn any updates..?

mx1up avatar Jan 30 '24 22:01 mx1up

@lrhn I applied all suggestions, please have a look at all unresolved conversations 🙏

mx1up avatar Feb 19 '24 18:02 mx1up

@lrhn ?

kevmoo avatar Apr 19 '24 23:04 kevmoo

As this repo has moved to https://github.com/dart-lang/tools/tree/main/pkgs/mime, please refile the PR there. Thanks!

mosuem avatar Aug 26 '24 16:08 mosuem

@mosuem done ✅

https://github.com/dart-lang/tools/pull/431

mx1up avatar Aug 26 '24 17:08 mx1up