0 purchases
dart app data
dart_app_data #
Dart Package for getting commonly used locations for storage on Windows, Mac, and Linux, such as the app data directories.
Inspired by path_provider (this does the same, except for Dart CLI apps or libs).
Originally written for a locally cached repository (think .m2 cache for Java). Tested and working on Windows, Mac, and Linux. Flutter is not supported.
How to Install #
Add this to your package's pubspec.yaml file:
dependencies:
dart_app_data: ^1.0.1
copied to clipboard
Usage #
With AppData #
import 'package:dart_app_data/dart_app_data.dart';
...
// Creates a folder if it does not already exist (only call once).
final myData = AppData.findOrCreate('.my_app');
// Get the location of the folder as a String
print(myData.path); // Outputs: C:\Users\MyUsername\AppData\Roaming\.my_app
// Get the location of the folder directly as a directory
print(myData.directory);
// Get the name of the cache
print(myData.name); // Outputs: .my_app
// ... Do whatever you want with the folder now.
// Want to delete it?
// myData.delete();
copied to clipboard
Without AppData #
import 'package:dart_app_data/src/locator.dart';
...
// No need for the AppData abstraction? Use the Locator helper.
print(Locator.getPlatformSpecificCachePath());
// Outputs: C:\Users\MyUsername\AppData\Roaming
copied to clipboard
Paths #
Windows: C:\Users\MyUsername\AppData\Roaming
macOS: /MyUsername/Library/Application Support
Linux: /MyUsername/user/
License #
See LICENSE in repository.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.