fluffychat/lib/utils/database/web.dart

18 lines
510 B
Dart
Raw Normal View History

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