FurryChat/lib/utils/database/web.dart

20 lines
553 B
Dart
Raw Normal View History

2020-10-15 13:51:24 +00:00
import 'dart:html';
2020-05-13 13:58:59 +00:00
import 'package:famedlysdk/famedlysdk.dart';
import 'package:flutter/material.dart';
2020-10-15 13:51:24 +00:00
import 'package:moor/moor_web.dart';
2020-05-13 13:58:59 +00:00
2020-07-20 15:33:52 +00:00
Future<Database> constructDb(
2020-05-22 10:21:16 +00:00
{bool logStatements = false,
String filename = 'database.sqlite',
2020-07-20 15:33:52 +00:00
String password = ''}) async {
2020-05-13 13:58:59 +00:00
debugPrint('[Moor] Using moor web');
2020-05-22 10:21:16 +00:00
return Database(WebDatabase.withStorage(
MoorWebStorage.indexedDbIfSupported(filename),
logStatements: logStatements));
2020-05-13 13:58:59 +00:00
}
Future<String> getLocalstorage(String key) async {
return await window.localStorage[key];
}