Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Executed dart2native report error error: import of dart:mirrors is not supported in the current Dart runtime #46

Open
nimengbo opened this issue Jan 7, 2020 · 2 comments

Comments

@nimengbo
Copy link

nimengbo commented Jan 7, 2020

import 'package:mustache/mustache.dart' as mustache;
import 'file_system.dart';

void renderTemplate(String absoluteSourcePath, String finalDestinationPath,
    Map<String, dynamic> context) {
  final sourceFile = fs.file(absoluteSourcePath);
  final templateContents = sourceFile.readAsStringSync();
  final renderedContents =
      mustache.Template(templateContents).renderString(context);

  final finalDestinationFile = fs.file(finalDestinationPath);
  finalDestinationFile.writeAsStringSync(renderedContents);
}

remove mustache import , dart2native can output the bin

@xxgreg
Copy link
Owner

xxgreg commented Jan 13, 2020

The library has a hard dependency on dart:mirrors at the moment. This means it's not possible to use with dart2native.

Should be pretty easy for someone to implement a patch.

See:
#19 (comment)

@maks
Copy link

maks commented Jul 3, 2020

I ran into exactly the same thing trying to do dart2native on dart-sitegen which had a dependency on this package and can confirm that changing over to reflected-mustache fork allows dart2native to compile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants