skip to Main Content
[Running] dart "c:UsersPCAndroidStudioProjectsFlutterXDlibmain.dart"
../../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;
^

[Done] exited with code=254 in 13.502 seconds

NOTHING, i did try nothing

3

Answers


  1. 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.

    EX)
    // import 'dart:ui' as ui;
    import 'package:flutter/material.dart';
    
    class PainterTest extends CustomPainter {
      @override
      void paint(Canvas canvas, Size size) {
        // TODO: implement paint
      }
    
      @override
      bool shouldRepaint(covariant CustomPainter oldDelegate) {
        // TODO: implement shouldRepaint
        throw UnimplementedError();
      }
    }
    
    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
  3. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search