libraryDirectory property
Returns a path to the library directory.
Should be used to put local storage files and caches that aren't temporal.
Implementation
FutureOr<Directory> get libraryDirectory async {
if (_libraryDirectory != null) {
return _libraryDirectory!;
}
Directory? directory;
try {
if (isLinux) {
directory ??= dataHome;
} else {
directory ??= await getLibraryDirectory();
}
} on MissingPluginException {
directory = Directory('');
} catch (_) {
directory ??= await cacheDirectory;
directory ??= await getApplicationDocumentsDirectory();
}
// Windows already contains both product name and company name in the path.
//
// Android already contains the bundle identifier in the path.
if (PlatformUtils.isWindows || PlatformUtils.isAndroid) {
return directory;
}
return Directory('${directory.path}/${Config.userAgentProduct}');
}