mime_type_extension 0.0.2 copy "mime_type_extension: ^0.0.2" to clipboard
mime_type_extension: ^0.0.2 copied to clipboard

Convert extension to mime type and mime type to extension and return it as String, Support 600+ types.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:mime_type_extension/mime_type_extension.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: Scaffold(
        appBar: AppBar(
          backgroundColor: Theme.of(context).colorScheme.inversePrimary,
          title: const Text("Example of Mime Type Extension"),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Text(
                'MimeType of .mp4 is ${MimeTypeExtension.instance.extensionToMimeType('.mp4')}',
              ),
              const Divider(),
              Text(
                'Extension of application/json is ${MimeTypeExtension.instance.mimeTypeToExtension('application/json')}',
              ),
            ],
          ),
        ),
      ),
    );
  }
}
3
likes
160
points
40
downloads

Publisher

unverified uploader

Weekly Downloads

Convert extension to mime type and mime type to extension and return it as String, Support 600+ types.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on mime_type_extension