Repository: flutter
Issue: Can't read file in integration test android
Labels: platform-android,framework,f: integration_test,has reproducible steps,P3,found in release: 2.6,found in release: 2.8,team-android,triaged-android

I had the same problem with [this issue](https://stackoverflow.com/questions/62546899/get-the-current-project-directory-from-flutter-integration-test)
So when I run integration test, the `Directory.current` is `/` - this is the root dir on my mac device and it's readonly.
I was trying to read json file & custom font in the test, so I have to pass the real path on my mac like:

```
setUpAll(() async {
    var currentDir = Directory.current.path;  // return "/"
    rootPath ='/Users/admin/Documents/flutter/my_app';
   final fontPath = '$rootPath/assets/fonts/custom_font.ttf';
   loader.addFont(File(fontPath)
          .readAsBytes()
          .then((bytes) => ByteData.view(Uint8List.fromList(bytes).buffer)));
   loader.load()
  // load json...
  var json = await File('$rootPath/assets/data.json'). readAsString();
  });

```
If I run command `flutter test integration_test` on ios, it works fine, I can load custom font, json & can also take screenshot with this path.
But when I run on android device, it throw file not found error with the same path when I load font, json
```
FileSystemException: Cannot open file, path = '/Users/admin/Documents/flutter/my_app/assets/fonts/custom_font.ttf' (OS Error: No such file or directory, errno = 2)
  dart:io                                                                                                                _File.readAsBytes
  Users/admin/Documents/flutter/my_app/integration_test/app_test.dart 49:11                                        main.<fn>
  Users/admin/Documents/flutter/my_app/integration_test/app_test.dart 42:12                                        main.<fn>
  ===== asynchronous gap ===========================
  package:stream_channel                                                                                                 _GuaranteeSink.add
  var/folders/11/wq1vn8yd2739xsmmzbq3m06w0000gn/T/flutter_tools.6Thidy/flutter_test_listener.DYB5ji/listener.dart 53:22  main.<fn>
  var/folders/11/wq1vn8yd2739xsmmzbq3m06w0000gn/T/flutter_tools.6Thidy/flutter_test_listener.DYB5ji/listener.dart 52:20  main.<fn>
```

So my questions are:
- Why do integration test has different directory path with unit test according to [this issue](https://github.com/flutter/flutter/issues/20907)? The unit flutter has the current project dir by default, but integration test has `/` as root
- What is the official way to read/write data in integration test? why I can't read file when run on android?


<details>
  <summary>flutter doctor -v</summary>

```
[✓] Flutter (Channel master, 2.6.0-12.0.pre.826, on Mac OS X 10.15.7 19H1519 darwin-x64, locale en-US)
    • Flutter version 2.6.0-12.0.pre.826 at /Users/admin/Documents/Soft/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 6c1455a23a (25 hours ago), 2021-11-23 21:13:05 -0500
    • Engine revision 539239e256
    • Dart version 2.16.0 (build 2.16.0-42.0.dev)
    • DevTools version 2.8.0

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/admin/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • ANDROID_HOME = /Users/admin/Library/Android/sdk
    • ANDROID_SDK_ROOT = /Users/admin/Library/Android/sdk
    • Java binary at: /Applications/Android Studio 4.2 Preview.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
    • All Android licenses accepted.

[!] Xcode - develop for iOS and macOS (Xcode 12.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    ! Flutter recommends a minimum Xcode version of 13.
      Download the latest version or update via the Mac App Store.
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio 4.2 Preview.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] VS Code (version 1.58.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.24.0

[✓] VS Code (version 1.63.0-insider)
    • VS Code at /Applications/Visual Studio Code - Insiders.app/Contents
    • Flutter extension version 3.28.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • Mac OS X 10.15.7 19H1519 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 96.0.4664.55
```

</details>