isolate_current_directory 1.2.0 copy "isolate_current_directory: ^1.2.0" to clipboard
isolate_current_directory: ^1.2.0 copied to clipboard

Support for isolated Directory.current.

example/isolate_current_directory_example.dart

import 'dart:io';

import 'package:isolate_current_directory/isolate_current_directory.dart';

void main() {
  withCurrentDirectory('lib', () async {
    // File and Directory created within "withCurrentDirectory"
    // will use 'lib' as the working directory.
    final src = Directory('src');
    print('Directory src exists? ${await src.exists()}');
    await src.list(recursive: true).forEach((child) => print(' * $child'));

    // But Process methods do not currently respect Directory.current,
    // so the working directory must be explicitly provided.
    final ls = await Process.run('ls', const [],
        workingDirectory: Directory.current.path);
    print('Result of running "ls" at ${Directory.current}');
    stdout.write(ls.stdout);
    stderr.write(ls.stderr);
  });
}
1
likes
150
pub points
17%
popularity

Publisher

unverified uploader

Support for isolated Directory.current.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

path

More

Packages that depend on isolate_current_directory