tekartik / sembast.dart

Simple io database
BSD 2-Clause "Simplified" License
763 stars 63 forks source link

Copy db file on flutter web for upload / backup #373

Open Sesa1988 opened 4 months ago

Sesa1988 commented 4 months ago

Hi,

is it possible to get the database file into memory in order to upload it to the cloud?

I do this on android:

final appDocumentDir = await getApplicationDocumentsDirectory();
var dbPath ='${appDocumentDir.path}/app-${EnvironmentHelper.envName}.db';
File file = File(dbPath);
await drive.files.update(
        fileToUpload,
        driveFile.id ?? '',
        uploadMedia: ga.Media(file.openRead(), file.lengthSync()),
        addParents: folderId,
      );

But I have to get the file also on the web.