liyuqian / metrics_center

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`dart:mirrors` dependencies block this from being used in a Flutter app

CareF opened this issue · comments

As long as an app import 'package:metrics_center/flutter.dart';, when doing flutter drive/run --profile it will show:

error: import of dart:mirrors is not supported in the current Dart runtime
Dart snapshot generator failed with exit code 254                       
                                                                        
                                                                        
FAILURE: Build failed with an exception.                                
                                                                        
* Where:                                                                
Script '/Users/minglyu/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 897
                                                                        
* What went wrong:                                                      
Execution failed for task ':app:compileFlutterBuildProfile'.            
> Process 'command '/Users/minglyu/flutter/bin/flutter'' finished with non-zero exit value 1
                                                                        
* Try:                                                                  
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
                                                                        
* Get more help at https://help.gradle.org                              
                                                                        
BUILD FAILED in 23s                   

It seems that this package is implicitly depending on dart:mirrors which is not compatible with flutter's dart runtime.

debug mode will let the app start but not fully functioning, with a different error message:

E/flutter (30963): [ERROR:flutter/shell/common/shell.cc(210)] Dart Error: error: import of dart:mirrors is not supported in the current Dart runtime
E/flutter (30963): [ERROR:flutter/shell/common/engine.cc(205)] Could not prepare to run the isolate.
E/flutter (30963): [ERROR:flutter/shell/common/engine.cc(144)] Engine not prepare and launch isolate.
E/flutter (30963): [ERROR:flutter/shell/common/shell.cc(487)] Could not launch engine with configuration.

With https://pub.dev/packages/import_path and

pub global activate import_path
pub global run import_path lib/flutter.dart dart:mirrors

it turns out to be gcloud/db.dart

Remove myself from the assignment as I'm not actively working on this. Will reassign myself once I get some time to work on it.

Closing this as our newest plan is to remove dependency on gcloud/db.dart (datastore) and only depend on gcloud/storage.dart. I just ran pub global run import_path lib/skiaperf.dart dart:mirrors and confirmed that gcloud/storage.dart doesn't depend on dart:mirrors:

Unable to find an import path from file:///Users/liyuqian/flutter/flutter/dev/benchmarks/metrics_center/lib/src/skiaperf.dart to dart:mirrors