integrate_platform 1.0.2 integrate_platform: ^1.0.2 copied to clipboard
Cross-platform [Platform] and File Management Just use [IntegratePlatform].
Cross-platform [Platform] and File Management.
Features #
- Use
IntegratePlatform
instead ofPlatform
to get platform information in io and web. - Packaged path_provider (In web, you'll get null).
- Packaged File Management. You can read and write a file in io and web.
Getting started #
To use this plugin, add integrate_platform
as a dependency in your pubspec.yaml file.
dependencies:
integrate_platform: ^1.0.2
Usage #
- Get platform information
// Get system version
bool operatingSystemVersion = IntegratePlatform.operatingSystemVersion;
// Get platform type
bool isDesktop = IntegratePlatform.isDesktop
- Get path in need
String? path = IntegratePlatform.getCurrentDirectory()
- Write and Read file
// Read file
final result = await IntegratePlatform.readFile();
if (result.success) {
data = result.content.toString();
}
// Write file
final result =
await IntegratePlatform.writeFile("hello world", "hello.txt");
path = result.path.toString();
The whole examples are in /example
folder.
Additional information #
Thanks to: