Home > OS >  i am getting Error: Not found: 'dart:html'
i am getting Error: Not found: 'dart:html'

Time:01-10

How can i solve this error and please tell me why do we get this , the given below is my main.dart file

enter image description here

CodePudding user response:

As described on the front-page of the API documentation for Dart: https://api.dart.dev

  • dart:html: DOM manipulation for web apps (available only to web apps).
  • dart:io: I/O for non-web apps.

So dart:html can only be used if your target platform is web (so Dart code compiled to JavaScript). In your case, you are trying to make an Android application which runs native on your phone. You can therefore not use dart:html but should instead look into dart:io (which are not available for web-applications) if you need access to IO operations.

  •  Tags:  
  • Related