This package is a polyfill for the core library constant names that are changing from Dart 1 to Dart 2.
In Dart 1, all core library constants were in
SCREAMING_CAPS. In Dart 2,
they're being changed to
camelCase. This package makes it possible for
packages to support both Dart 1 and Dart 2 by providing
that work on all versions of Dart.
This package has a library for each library
dart: library that contained
constants in Dart 1. These libraries contain only constants, using the Dart 2
names. They should be imported using a prefix so as to avoid colliding with core
import 'package:dart2_constant/convert.dart' as convert; String decodeUtf8(List<int> bytes) => convert.utf8.decode(bytes);
Note that this even supports constants that haven't yet migrated in the core
libraries, such as those in
dart:html. These are provided for
compatibility with future SDK changes.
How It Works #
Each version of
dart2_constant has two releases, one tagged
only compatible SDKs that have old-style constants and one tagged
that's only compatible with SDKs that have new-style constants. As long as you
dart2_constant, pub's version solver will make sure your users get
a version of it that works for them.
See Also #
- Widen SDK constraint to include 2.0.0.
- Fix the homepage URL.
- Initial version.
Use this package as a library
1. Depend on it
Add this to your package's pubspec.yaml file:
dependencies: dart2_constant: ^1.0.2+dart2
2. Install it
You can install packages from the command line:
$ pub get
Alternatively, your editor might support
Check the docs for your editor to learn more.
3. Import it
Now in your Dart code, you can use:
import 'package:dart2_constant/async.dart'; import 'package:dart2_constant/convert.dart'; import 'package:dart2_constant/core.dart'; import 'package:dart2_constant/developer.dart'; import 'package:dart2_constant/html.dart'; import 'package:dart2_constant/io.dart'; import 'package:dart2_constant/isolate.dart'; import 'package:dart2_constant/math.dart'; import 'package:dart2_constant/svg.dart'; import 'package:dart2_constant/typed_data.dart'; import 'package:dart2_constant/web_gl.dart'; import 'package:dart2_constant/web_sql.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
This package is not analyzed, because it is discontinued.
Health issues and suggestions
Document public APIs. (-1 points)
2309 out of 2309 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.
|Dart SDK||>=2.0.0-dev.34.0 <3.0.0|