File tree Expand file tree Collapse file tree 14 files changed +84
-26
lines changed
supabase-edge-function-auth Expand file tree Collapse file tree 14 files changed +84
-26
lines changed Original file line number Diff line number Diff line change 11// This file performs setup of the PowerSync database
2- import 'dart:io' ;
3-
2+ import 'package:universal_io/io.dart' ;
43import 'package:flutter/foundation.dart' ;
54import 'package:logging/logging.dart' ;
65import 'package:path/path.dart' ;
@@ -137,8 +136,13 @@ String? getUserId() {
137136}
138137
139138Future <String > getDatabasePath () async {
140- final dir = kIsWeb ? Directory ('/' ) : await getApplicationSupportDirectory ();
141- return join (dir.path, 'powersync-demo.db' );
139+ const dbFilename = 'powersync-demo.db' ;
140+ // getApplicationSupportDirectory is not supported on Web
141+ if (kIsWeb) {
142+ return dbFilename;
143+ }
144+ final dir = await getApplicationSupportDirectory ();
145+ return join (dir.path, dbFilename);
142146}
143147
144148Future <void > openDatabase () async {
Original file line number Diff line number Diff line change @@ -540,6 +540,14 @@ packages:
540540 url: "https://pub.dev"
541541 source: hosted
542542 version: "1.3.2"
543+ universal_io:
544+ dependency: "direct main"
545+ description:
546+ name: universal_io
547+ sha256: "1722b2dcc462b4b2f3ee7d188dad008b6eb4c40bbd03a3de451d82c78bba9aad"
548+ url: "https://pub.dev"
549+ source: hosted
550+ version: "2.2.2"
543551 url_launcher:
544552 dependency: transitive
545553 description:
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ dependencies:
1717 path : ^1.8.3
1818 logging : ^1.2.0
1919 sqlite_async : ^0.7.0-alpha.1
20+ universal_io : ^2.2.2
2021
2122dev_dependencies :
2223 flutter_test :
Original file line number Diff line number Diff line change 11// This file performs setup of the PowerSync database
2- import 'dart:io' ;
3-
2+ import 'package:universal_io/io.dart' ;
43import 'package:flutter/foundation.dart' ;
54import 'package:logging/logging.dart' ;
65import 'package:path/path.dart' ;
@@ -140,8 +139,13 @@ String? getUserId() {
140139}
141140
142141Future <String > getDatabasePath () async {
143- final dir = kIsWeb ? Directory ('/' ) : await getApplicationSupportDirectory ();
144- return join (dir.path, 'powersync-demo.db' );
142+ const dbFilename = 'powersync-demo.db' ;
143+ // getApplicationSupportDirectory is not supported on Web
144+ if (kIsWeb) {
145+ return dbFilename;
146+ }
147+ final dir = await getApplicationSupportDirectory ();
148+ return join (dir.path, dbFilename);
145149}
146150
147151Future <void > openDatabase () async {
Original file line number Diff line number Diff line change @@ -540,6 +540,14 @@ packages:
540540 url: "https://pub.dev"
541541 source: hosted
542542 version: "1.3.2"
543+ universal_io:
544+ dependency: "direct main"
545+ description:
546+ name: universal_io
547+ sha256: "1722b2dcc462b4b2f3ee7d188dad008b6eb4c40bbd03a3de451d82c78bba9aad"
548+ url: "https://pub.dev"
549+ source: hosted
550+ version: "2.2.2"
543551 url_launcher:
544552 dependency: transitive
545553 description:
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ dependencies:
1717 path : ^1.8.3
1818 logging : ^1.2.0
1919 sqlite_async : ^0.7.0-alpha.1
20+ universal_io : ^2.2.2
2021
2122dev_dependencies :
2223 flutter_test :
Original file line number Diff line number Diff line change 1- import 'dart:io' ;
2-
31import 'package:flutter/foundation.dart' ;
42import 'package:powersync/powersync.dart' ;
53import 'package:supabase_flutter/supabase_flutter.dart' ;
@@ -27,8 +25,13 @@ final List<RegExp> fatalResponseCodes = [
2725late final PowerSyncDatabase db;
2826
2927Future <String > getDatabasePath () async {
30- final dir = kIsWeb ? Directory ('/' ) : await getApplicationSupportDirectory ();
31- return join (dir.path, 'powersync-demo.db' );
28+ const dbFilename = 'powersync-demo.db' ;
29+ // getApplicationSupportDirectory is not supported on Web
30+ if (kIsWeb) {
31+ return dbFilename;
32+ }
33+ final dir = await getApplicationSupportDirectory ();
34+ return join (dir.path, dbFilename);
3235}
3336
3437bool isLoggedIn () {
Original file line number Diff line number Diff line change @@ -604,6 +604,14 @@ packages:
604604 url: "https://pub.dev"
605605 source: hosted
606606 version: "1.3.2"
607+ universal_io:
608+ dependency: "direct main"
609+ description:
610+ name: universal_io
611+ sha256: "1722b2dcc462b4b2f3ee7d188dad008b6eb4c40bbd03a3de451d82c78bba9aad"
612+ url: "https://pub.dev"
613+ source: hosted
614+ version: "2.2.2"
607615 url_launcher:
608616 dependency: transitive
609617 description:
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ dependencies:
4141 path_provider : ^2.1.1
4242 path : ^1.8.3
4343 logging : ^1.2.0
44+ universal_io : ^2.2.2
4445
4546dev_dependencies :
4647 flutter_test :
Original file line number Diff line number Diff line change 11// This file performs setup of the PowerSync database
2- import 'dart:io' ;
3-
42import 'package:flutter/foundation.dart' ;
53import 'package:logging/logging.dart' ;
64import 'package:path/path.dart' ;
@@ -148,8 +146,13 @@ String? getUserId() {
148146}
149147
150148Future <String > getDatabasePath () async {
151- final dir = kIsWeb ? Directory ('/' ) : await getApplicationSupportDirectory ();
152- return join (dir.path, 'powersync-demo.db' );
149+ const dbFilename = 'powersync-demo.db' ;
150+ // getApplicationSupportDirectory is not supported on Web
151+ if (kIsWeb) {
152+ return dbFilename;
153+ }
154+ final dir = await getApplicationSupportDirectory ();
155+ return join (dir.path, dbFilename);
153156}
154157
155158Future <void > openDatabase () async {
You can’t perform that action at this time.
0 commit comments