skip to Main Content

Originally I can run the flutter code in AS, but suddenly can’t.
I didn’t modify a code in ffi.dart file…
I wanna run the code using Chrome(Web)

Launching libmain.dart on Chrome in debug mode…
Waiting for connection from debug service on Chrome…
lib/main.dart:1:8: Error: Dart library ‘dart:ffi’ is not available on this platform.
import ‘dart:ffi’;
^
Context: The unavailable library ‘dart:ffi’ is imported through these packages:

web_entrypoint.dart => package:contact => dart:ffi

Detailed import paths for (some of) the these imports:

web_entrypoint.dart => package:contact/main.dart => dart:ffi

Failed to compile application.

upgraded flutter, dart through CMD

2

Answers


  1. Try to find file in your project that import dart:ffi

    import 'dart:ffi';
    

    and delete that import line, here is the relevant error: Error: Not found: 'dart:ffi' with flutter web

    Login or Signup to reply.
  2. FLUTTER MOBILE:
    I had this problem on a Flutter mobile project. Seems it was a PICNIC issue.

    My mobile device wasn’t plugged into the PC, so Flutter attempted to build for Web. Problem is dart:ffi doesn’t work on Web, so you get this error.

    Just plugged my device in properly and then picked it as the build destination. Boom, works.

    FLUTTER WEB:
    While searching for a fix, I found various answers around the web mentioning that people are either importing dart:ffi themselves in the project, or they are using a non-web library which has dart:ffi as a dependency.
    Hope this helps 🙂

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