initDatabaseExpander static method

Future<void> initDatabaseExpander()

Implementation

static Future<void> initDatabaseExpander() async {
  Directory directory;
  // use path provider only if the current directory is not writeable
  if (!(isWriteable('.') && preferCurrentDirectory)) {
    if (Platform.isMacOS) {
      // MacOS path_provider implementation was too stupid (unimplemented or null operator problem)
      directory = Directory('~/Library/Application Support');
    } else if (Platform.isWindows || Platform.isLinux || Platform.isAndroid) {
      directory = await getApplicationSupportDirectory();
    } else if (Platform.isAndroid) {
      directory = await getApplicationDocumentsDirectory();
    } else {
      try {
        directory = await getLibraryDirectory();
      } on MissingPluginException {
        // fall back to the current directory
        directory = Directory.current;
      }
    }
  } else {
    directory = Directory.current;
  }
  _databasesPath = directory.path;
}