dart-lang / dart-lang/native

[ffigen] Use `package:file` instead of `dart:io` directly

Open
#1,405 0 comments 0 reactions 0 assignees View on GitHub
P3 package:ffigen package:ffigenpad
Dominant language
Dart
Stars
275
Forks
144
Avg merge
2d 10h
Merged PRs (30d)
47

Description

Currently FFIgen uses `dart:io` directly.

This forces our FFIgenPad prototype to use [IOOverrides](https://api.flutter.dev/flutter/dart-io/IOOverrides-class.html).

If we were to use `package:file`, we could potentially wire up all File reads and writes using a `FileSystem` that targets the emscripten file system when we use WASM.

Since this is a more general problem than just our use case, I've gone ahead and file an issue on the Dart SDK to see if others think that would be a good direction to go in:

* https://github.com/dart-lang/sdk/issues/56404

So let's wait on some feedback there before we head in this direction. (marking issue low prio)

Note, it would be tempting to run the the whole of FFIgen with a [MemoryFileSystem](https://pub.dev/documentation/file/latest/memory/MemoryFileSystem-class.html) and make our test suite blazing fast. However, that doesn't work due to libclang wanting to read from the `LocalFileSystem`.

FYI @TheComputerM @mannprerak2

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.