provide better defaults for mimetype to extension mapping
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
@kevmoo , @natebosch could you have a look please? 🙏
@lrhn I applied all your suggestions, please have another look
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?
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
removed addMimeType from documentation
@natebosch @lrhn any updates..?
@lrhn I applied all suggestions, please have a look at all unresolved conversations 🙏
@lrhn ?
As this repo has moved to https://github.com/dart-lang/tools/tree/main/pkgs/mime, please refile the PR there. Thanks!
@mosuem done ✅
https://github.com/dart-lang/tools/pull/431