Maheswari
Maheswari

Reputation: 85

If picked file name have no extensions, how we will get file mime type in flutter

I'm using file picker for my application. In that, I want to know picked file mime type even file name has no extension. How it is possible?

Upvotes: 4

Views: 3707

Answers (1)

HasilT
HasilT

Reputation: 2609

use this package mime

You can get mime type from file path like this:

import 'package:mime/mime.dart';
....
lookupMimeType(file.path) // output: Image/Jpeg

Upvotes: 3

Related Questions