deprecated_ web_ configuration
Details about the 'deprecated_web_configuration' diagnostic produced by the Dart analyzer.
'dart:{0}' is deprecated and shouldn't be used as an import/export configuration.
Description
#The analyzer produces this diagnostic when a deprecated library is used in an import configuration. The following web libraries are deprecated: 'dart:html', 'dart:indexed_db', 'dart:js', 'dart:js_util', 'dart:svg', 'dart:web_audio', 'dart:web_gl'.
Example
#Given a package containing a file named a.dart:
class C {}
a file named a_io.dart:
class C {}
and a file named a_web.dart:
class C {}
The following code produces this diagnostic because the configuration uses
the dotted identifier dart.library.html:
import 'src/a.dart'
if (dart.library.io) 'src/a_io.dart'
if (dart.library.html) 'src/a_web.dart';
var c = C();
Common fixes
#The typical fix is to use the dart.library.js_interop configuration:
import 'src/a.dart'
if (dart.library.io) 'src/a_io.dart'
if (dart.library.js_interop) 'src/a_web.dart';
var c = C();
Unless stated otherwise, the documentation on this site reflects Dart 3.13.7. Report an issue.