app_tmp_path 2.0.1 copy "app_tmp_path: ^2.0.1" to clipboard
app_tmp_path: ^2.0.1 copied to clipboard

Generate a unique path in app temporary directory.

app_tmp_path #

pub package

  • Generate a unique path in app temporary directory.
  • Generate a unique file name.
  • Clear all contents in app temporary directory.

Usage #

import 'package:app_tmp_path/app_tmp_path.dart';

void main() async {
  // Generate a unique path in app temporary directory.
  print(await createAppTmpPath());
  // /var/folders/q5/yvcxrtbn7mq5h4r4zvjhp_v40000gn/T/e8d9cbbcc1944c32a68d3d3739618dcb1679847188986

  // You can also specify a prefix for the generated path.
  print(await createAppTmpPath(prefix: 'test'));
  // /var/folders/q5/yvcxrtbn7mq5h4r4zvjhp_v40000gn/T/test399b42ececa84e069cf582b0adf1cea61679847188991

  // If you want to generate a unique file name, you can use tmpFileName() function.
  print(tmpFileName() + '.txt');
  // 30937c061c944d059dfc298242ef1e211679847188991.txt

  // You can also clean the app's temporary directory.
  await cleanAppTmpDir();

  // To get the path of the app's temporary directory, you can use initAppTmpDir() function.
  // This calls getTemporaryDirectory() from path_provider package internally.
  print(await initAppTmpDir());
}
0
likes
145
points
53
downloads

Documentation

API reference

Publisher

verified publisherflutter-cavalry.com

Weekly Downloads

Generate a unique path in app temporary directory.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (license)

Dependencies

flutter, path, path_provider, uuid

More

Packages that depend on app_tmp_path