Angular Dart Import Error With Tracing.dart

Issue

I am using Angular Dart for a project. In my pubspec.yaml I have

dependencies:
  browser: any
  angular: "^1.1.2+2"
  shadow_dom: any
  json_object: any   
  bootjack: any
  crypto: any
  xml: "^2.3.2"
transformers:
- angular

for my dependencies. When I run my program in Dartium I get the error

The requested built-in library is not available on Dartium.'package:angular/tracing.dart': error: line 9 pos 1: library handler failed
import "dart:developer";
^: package:angular/tracing.dart

I never reference or use anything out of the tracing.dart so I’m not sure why this is causing an error.

Solution

The tracing package is directly using dart:profiler, which was deprecated and now removed. You can now use dart:developer instead, both libraries are compatible.

I would suggest to fork the package, replace dart:profiler with dart:developer (no other changes are required) and send a pull request. I already forked and fixed the package some time ago here, but I think the original package is inactive so I didn’t created an PR. You can use my fork by adding this to your pubspec.yaml:

dependency_overrides:
  tracing:
    git: https://github.com/Fox32/tracing.dart.git

Answered By – Fox32

Answer Checked By – Robin (FlutterFixes Admin)

Leave a Reply

Your email address will not be published.