Skip to content

Dart2Wasm compiler fails building when dart:ffi library is conditionally imported #55948

@sroddy

Description

@sroddy

When compiling a simple flutter project in wasm using the latest dart stable version, the compiler will refuse building once a library that conditionally imports "dart:ffi" is imported and used.

simple steps to reproduce

main.dart:

import 'e.dart';

void main() {
  print(e());
}

e.dart:

export 'e_stub.dart' if (dart.library.ffi) 'e_ffi.dart';

e_stub.dart:

String e() => 'hello';

e_ffi.dart:

import 'dart:ffi';
String e() => 'hello';

interestingly enough, if the e.dart file is rewritten like this...

e.dart:

export 'e_ffi.dart' if (dart.library.js_interop) 'e_stub.dart';

...the compiler doesn't complain

Metadata

Metadata

Assignees

Labels

area-dart2wasmIssues for the dart2wasm compiler.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions