p-hatan/ mirror

pub repository

mirror.p-hatan.com

dart2_constant

1.0.2+dart2

A polyfill for Dart 2 constant names.

This package is discontinued upstream.

Download archive

Readme

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 camelCase constants 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 library names:

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:io and dart:html. These are provided for compatibility with future SDK changes.

How It Works

Each version of dart2_constant has two releases, one tagged +dart1 that's only compatible SDKs that have old-style constants and one tagged +dart2 that's only compatible with SDKs that have new-style constants. As long as you depend on dart2_constant, pub's version solver will make sure your users get a version of it that works for them.

See Also

The dart2_fix package can be used to automatically migrate constant references from Dart 1 style to Dart 2 style. It doesn't currently support migrating to dart2_constant references, though.

Changelog

1.0.2

  • Widen SDK constraint to include 2.0.0.

1.0.1

  • Fix the homepage URL.

1.0.0

  • Initial version.

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.com
flutter pub add dart2_constant
pubspec.yaml
name: dart2_constant
version: 1.0.2+dart2
description: A polyfill for Dart 2 constant names.
author: Dart Team <misc@dartlang.org>
homepage: https://github.com/dart-lang/dart2_constant

environment:
  sdk: '>=2.0.0-dev.34.0 <3.0.0'

dev_dependencies:
  args: "^1.0.0"
  analyzer: ">=0.30.0 <0.33.0"
  dart_style: "^1.0.0"
  path: "^1.0.0"

Version history

VersionPublishedArchiveSHA-256
1.0.0+dart12018-04-02T23:00:17.242840ZDownload43e8def60ed161fadf6a260cee7102dbf220832b1c2a63a86dfb6289574ff93f
1.0.0+dart22018-04-02T23:00:26.669862ZDownload86375491d209b5889c69f0e992713ae0eec41077aa58547a20e7ac3509065906
1.0.1+dart12018-04-03T23:07:48.476134ZDownload7c7ac7e1ea27b94bfc653a02c3b394f11e5d1de57fbcf18c555cec9f7e5d435c
1.0.1+dart22018-04-03T23:08:15.304181ZDownload54e665461508e83f76a87da554a342085ebd38d0c998a96856009179a08567ab
1.0.2+dart22018-08-03T22:45:57.192819ZDownloadd9791e9e1f43ab97909333f37562df8e383a906940f44700de77dd0b0a081b18

Dependencies

No direct dependencies declared.