The following libraries:
are not supported outside of a web context.
Using them in a non-Flutter library or in a Flutter library that is not a web plugin may lead to runtime errors.
The rule reports an issue on any import
statement that references one of the above libraries:
import 'dart:html'; // Non compliant
import 'dart:js'; // Non compliant
import 'dart:js_util'; // Non compliant
A non-Flutter library is identified as a library with a pubspec.yaml
file that does not have a dependency on the flutter
package:
dependencies:
other_package: ^1.0.0
# Missing flutter dependency
A Flutter library that is a web plugin is identified as a library with a pubspec.yaml
file that has a dependency on the
flutter
package and declares the web context, potentially among other platforms:
name: my_project
dependencies:
flutter:
sdk: flutter
flutter:
plugin:
platforms:
web:
flutter_web: any
flutter_web_ui: any
android:
package: com.example.hello
pluginClass: HelloPlugin