@@ -113,8 +113,17 @@ class LocalDbBridge extends LocalSbRequestImpl {
113113 log ('Functions bound successfully' );
114114
115115 /// Define default route.
116- final appDir = await getApplicationDocumentsDirectory ();
117- log ('Using app directory: ${appDir .path }' );
116+ Directory appDir;
117+ try {
118+ // Usar Application Documents Directory como estándar
119+ appDir = await getApplicationDocumentsDirectory ();
120+ log ('Using Application Documents Directory: ${appDir .path }' );
121+ } catch (e) {
122+ // Fallback a Application Support Directory si falla el Documents
123+ log ('Application Documents Directory failed: $e ' );
124+ appDir = await getApplicationSupportDirectory ();
125+ log ('Using Application Support Directory fallback: ${appDir .path }' );
126+ }
118127
119128 /// Initialize database with default route and database name.
120129 // Ensure database name doesn't have extension, Rust expects .lmdb
@@ -164,7 +173,12 @@ class LocalDbBridge extends LocalSbRequestImpl {
164173 _dbInstance = null ;
165174
166175 // Reinicializar solo la instancia de base de datos
167- final appDir = await getApplicationDocumentsDirectory ();
176+ Directory appDir;
177+ try {
178+ appDir = await getApplicationDocumentsDirectory ();
179+ } catch (e) {
180+ appDir = await getApplicationSupportDirectory ();
181+ }
168182 final dbBaseName = _lastDatabaseName! .replaceAll ('.db' , '' );
169183 await _init ('${appDir .path }/$dbBaseName ' );
170184 log ('Database connection reestablished successfully' );
0 commit comments