1

How can I store images in a MongoDB through Flutter/Dart?

We are developing an android application using MongoDB and Flutter. We want to store images during the registration of users in our app. I already referred the mongo-dart documentation but still, I can't find any solution about this.

yash_412
  • 17
  • 8

2 Answers2

1

I would suggest encoding your images to Base64 format. Then you can store them technically as plain text. There is a base64Encode function in dart:convert package.

You can also check this discussion: how to convert an image to base64 image in flutter?

Marek Naskret
  • 401
  • 3
  • 5
1

MongoDB has GridFS for storing files:

A convention for storing large files in a MongoDB database. All of the official MongoDB drivers support this convention, as does the mongofiles program.

It looks like mongo-dart supports it as well although it's missing the documentation.

Jiří Pospíšil
  • 14,296
  • 2
  • 41
  • 52