../../Documents/FlutterDev/flutter/packages/flutter/lib/src/material/animated_icons.dart:9:8: Error: Dart library ‘dart:ui’ is not available on this platform.
import ‘dart:ui’ as ui show Canvas, Paint, Path;
^
Context: The unavailable library ‘dart:ui’ is imported through these packages:
package:flutterxd => package:flutter => dart:ui
...
Detailed import paths for (some of) the these imports:
package:flutterxd/main.dart => package:flutter/material.dart => package:flutter/src/material/about.dart => package:flutter/foundation.dart => package:flutter/src/foundation/assertions.dart => package:flutter/src/foundation/diagnostics.dart => package:flutter/src/foundation/debug.dart => dart:ui
package:flutterxd/main.dart => package:flutter/material.dart => package:flutter/src/material/about.dart => package:flutter/foundation.dart => package:flutter/src/foundation/binding.dart => dart:ui
package:flutterxd/main.dart => package:flutter/material.dart => package:flutter/src/material/about.dart => package:flutter/foundation.dart => package:flutter/src/foundation/binding.dart => package:flutter/src/foundation/assertions.dart => package:flutter/src/foundation/diagnostics.dart => package:flutter/src/foundation/debug.dart => dart:ui
package:flutterxd/main.dart => package:flutter/material.dart => package:flutter/src/material/about.dart => package:flutter/foundation.dart => package:flutter/src/foundation/binding.dart => package:flutter/src/foundation/debug.dart => dart:ui
package:flutterxd/main.dart => package:flutter/material.dart => package:flutter/src/material/about.dart => package:flutter/foundation.dart => package:flutter/src/foundation/change_notifier.dart => dart:ui
package:flutterxd/main.dart => package:flutter/material.dart => package:flutter/src/material/about.dart => package:flutter/foundation.dart => package:flutter/src/foundation/change_notifier.dart => package:flutter/src/foundation/assertions.dart => package:flutter/src/foundation/diagnostics.dart => package:flutter/src/foundation/debug.dart => dart:ui
package:flutterxd/main.dart => package:flutter/material.dart => package:flutter/src/material/about.dart => package:flutter/foundation.dart => package:flutter/src/foundation/change_notifier.dart => package:flutter/src/foundation/diagnostics.dart => package:flutter/src/foundation/debug.dart => dart:ui
package:flutterxd/main.dart => package:flutter/material.dart => package:flutter/src/material/about.dart => package:flutter/foundation.dart => package:flutter/src/foundation/change_notifier.dart => package:flutter/src/foundation/memory_allocations.dart => dart:ui
package:flutterxd/main.dart => package:flutter/material.dart => package:flutter/src/material/about.dart => package:flutter/foundation.dart => package:flutter/src/foundation/change_notifier.dart => package:flutter/src/foundation/memory_allocations.dart => package:flutter/src/foundation/assertions.dart => package:flutter/src/foundation/diagnostics.dart => package:flutter/src/foundation/debug.dart => dart:ui
package:flutterxd/main.dart => package:flutter/material.dart => package:flutter/src/material/about.dart => package:flutter/foundation.dart => package:flutter/src/foundation/change_notifier.dart => package:flutter/src/foundation/memory_allocations.dart => package:flutter/src/foundation/diagnostics.dart => package:flutter/src/foundation/debug.dart => dart:ui
package:flutterxd/main.dart => package:flutter/material.dart => package:flutter/src/material/about.dart => package:flutter/foundation.dart => package:flutter/src/foundation/debug.dart => dart:ui
package:flutterxd/main.dart => package:flutter/material.dart => package:flutter/src/material/about.dart => package:flutter/foundation.dart => package:flutter/src/foundation/diagnostics.dart => package:flutter/src/foundation/debug.dart => dart:ui
package:flutterxd/main.dart => package:flutter/material.dart => package:flutter/src/material/about.dart => package:flutter/foundation.dart => package:flutter/src/foundation/key.dart => package:flutter/src/foundation/diagnostics.dart => package:flutter/src/foundation/debug.dart => dart:ui
package:flutterxd/main.dart => package:flutter/material.dart => package:flutter/src/material/about.dart => package:flutter/foundation.dart => package:flutter/src/foundation/memory_allocations.dart => dart:ui
package:flutterxd/main.dart => package:flutter/material.dart => package:flutter/src/material/about.dart => package:flutter/foundation.dart => package:flutter/src/foundation/memory_allocations.dart => package:flutter/src/foundation/assertions.dart => package:flutter/src/foundation/diagnostics.dart => package:flutter/src/foundation/debug.dart => dart:ui
package:flutterxd/main.dart => package:flutter/material.dart => package:flutter/src/material/about.dart => package:flutter/foundation.dart => package:flutter/src/foundation/memory_allocations.dart => package:flutter/src/foundation/diagnostics.dart => package:flutter/src/foundation/debug.dart => dart:ui
package:flutterxd/main.dart => package:flutter/material.dart => package:flutter/src/material/about.dart => package:flutter/scheduler.dart => package:flutter/src/scheduler/binding.dart => dart:ui
package:flutterxd/main.dart => package:flutter/material.dart => package:flutter/src/material/about.dart => package:flutter/scheduler.dart => package:flutter/src/scheduler/binding.dart => package:flutter/src/scheduler/priority.dart => package:flutter/foundation.dart => package:flutter/src/foundation/assertions.dart => package:flutter/src/foundation/diagnostics.dart => package:flutter/src/foundation/debug.dart => dart:ui
package:flutterxd/main.dart => package:flutter/material.dart => package:flutter/src/material/about.dart => package:flutter/scheduler.dart => package:flutter/src/scheduler/binding.dart => package:flutter/src/scheduler/priority.dart => package:flutter/foundation.dart => package:flutter/src/foundation/binding.dart => dart:ui
package:flutterxd/main.dart => package:flutter/material.dart => package:flutter/src/material/about.dart => package:flutter/scheduler.dart => package:flutter/src/scheduler/binding.dart => package:flutter/src/scheduler/priority.dart => package:flutter/foundation.dart => package:flutter/src/foundation/binding.dart => package:flutter/src/foundation/assertions.dart => package:flutter/src/foundation/diagnostics.dart => package:flutter/src/foundation/debug.dart => dart:ui
package:flutterxd/main.dart => package:flutter/material.dart => package:flutter/src/material/about.dart => package:flutter/scheduler.dart => package:flutter/src/scheduler/binding.dart => package:flutter/src/scheduler/priority.dart => package:flutter/foundation.dart => package:flutter/src/foundation/binding.dart => package:flutter/src/foundation/debug.dart => dart:ui
...
../../Documents/FlutterDev/flutter/packages/flutter/lib/src/material/animated_icons.dart:10:8: Error: Dart library ‘dart:ui’ is not available on this platform.
import ‘dart:ui’ show lerpDouble;
^
../../Documents/FlutterDev/flutter/packages/flutter/lib/src/material/app.dart:5:8: Error: Dart library ‘dart:ui’ is not available on this platform.
import ‘dart:ui’ as ui;
^
../../Documents/FlutterDev/flutter/packages/flutter/lib/src/material/app_bar_theme.dart:5:8: Error: Dart library ‘dart:ui’ is not available on this platform.
import ‘dart:ui’ show lerpDouble;
^
../../Documents/FlutterDev/flutter/packages/flutter/lib/src/material/arc.dart:6:8: Error: Dart library ‘dart:ui’ is not available on this platform.
import ‘dart:ui’ show lerpDouble;
^
../../Documents/FlutterDev/flutter/packages/flutter/lib/src/material/badge_theme.dart:5:8: Error: Dart library ‘dart:ui’ is not available on this platform.
import ‘dart:ui’ show lerpDouble;
^
../../Documents/FlutterDev/flutter/packages/flutter/lib/src/material/banner_theme.dart:5:8: Error: Dart library ‘dart:ui’ is not available on this platform.
import ‘dart:ui’ show lerpDouble;
^
../../Documents/FlutterDev/flutter/packages/flutter/lib/src/material/bottom_app_bar_theme.dart:5:8: Error: Dart library ‘dart:ui’ is not available on this platform.
import ‘dart:ui’ show lerpDouble;
^
../../Documents/FlutterDev/flutter/packages/flutter/lib/src/material/bottom_navigation_bar_theme.dart:5:8: Error: Dart library ‘dart:ui’ is not available on this platform.
import ‘dart:ui’ show lerpDouble;
^
NOTHING, i did try nothing
3
Answers
If you want to use classes such as Canvas, Paint, and Path,
it is enough to import ‘package:flutter/material.dart’ instead of dart:ui.
Clear import ‘dart:ui’ as ui;
just add import ‘package:flutter/material.dart’;
Also check your class extends CustomPainter.
Substituting import ‘package:flutter/material.dart’ did NOT resolve the problem.
I have never actually used "import ‘package:flutter/dart:ui’" but keep getting the same warning when trying out downloaded examples.
Check your intalled extensions if there are any c++ or linux extensions then uninstall them. In my case i uninstalled the CMake extension and then it worked. But make sure you have everything set up using flutter doctor -v