mustache
mustache copied to clipboard
Executed dart2native report error error: import of dart:mirrors is not supported in the current Dart runtime
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
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: https://github.com/xxgreg/mustache/issues/19#issuecomment-562525727
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.