os_mime_type 0.0.1 os_mime_type: ^0.0.1 copied to clipboard
Convert Mime Type to Extension or Extension Format to Mime
import 'package:flutter/material.dart';
import 'package:os_mime_type/os_mime_type.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'OS Mime Type Demo',
home: Scaffold(
appBar: AppBar(
title: const Text('OS Mime Type Demo'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'Mime Type from Extension: ${mimeFromExtension(extension: ".png")}',
),
Text(
'Mime Type from File Name: ${mimeFromFileName(fileName: "image.jpg")}',
),
Text(
'Extension from Mime: ${extensionFromMime(mime: "application/json")}',
),
],
),
),
),
);
}
}