safe_config icon indicating copy to clipboard operation
safe_config copied to clipboard

import of dart:mirrors is not supported in the current Dart runtime

Open ashwini1028 opened this issue 6 years ago • 5 comments

I am trying to execute below code:

import 'dart:io';
import 'package:safe_config/safe_config.dart';

class ApplicationConfiguration extends Configuration {
ApplicationConfiguration(String fileName) : super.fromFile(File(fileName));

String password;
}

void main() {
var config = new ApplicationConfiguration("config.yaml");
print("${config.password}");
}

config.yaml is having:

password: pwd123

I am not sure why i am getting import error

import of dart:mirrors is not supported in the current Dart runtime

ashwini1028 avatar Aug 25 '19 08:08 ashwini1028

dart:mirrors is the reflection library in Dart. Not sure what environment you are running on, but it is available on the Dart JIT VM. Work is currently in progress to provide a source-generated solution that does not depend on mirrors.

itsjoeconway avatar Aug 26 '19 18:08 itsjoeconway

I am having the same issue. I am trying to use the config file to build an application in android studio using flutter.

aakashshah94 avatar Oct 06 '19 21:10 aakashshah94

Me too, my IDE is Intellij and I have the same issue.

AlbertoSaezVela avatar Oct 08 '19 15:10 AlbertoSaezVela

I have the same problem. I want to use the new dart2native to compile my CLI tool to a single binary, but dart2native does not support dart:mirrors. (source: https://medium.com/dartlang/dart2native-a76c815e6baf)

Is there an ETA when the transition to the source-generated solution will be available?

safe_config is really useful. Especially with something like dart2native.

pycebs avatar Nov 07 '19 00:11 pycebs

In progress with: https://github.com/stablekernel/aqueduct/issues/669

itsjoeconway avatar Nov 07 '19 02:11 itsjoeconway