Remove upper case constants (#96)
Remove usage of upper-case constants.
Updates SDK requirement to 2.0.0-dev.17.0
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d4cc690..7e9fbc3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.15.2+16
+
+* Updated SDK version to 2.0.0-dev.17.0
+
## 0.15.2+15
* Officially deprecated this package. Not supported in Dart 2.
diff --git a/lib/src/asset/asset.dart b/lib/src/asset/asset.dart
index 15794e5..41e7189 100644
--- a/lib/src/asset/asset.dart
+++ b/lib/src/asset/asset.dart
@@ -38,7 +38,7 @@
///
/// If the asset was created from a [String] the original string is always
/// returned and [encoding] is ignored. Otherwise, the binary data of the
- /// asset is decoded using [encoding], which defaults to [UTF8].
+ /// asset is decoded using [encoding], which defaults to [utf8].
Future<String> readAsString({Encoding encoding});
/// Streams the binary contents of the asset.
diff --git a/lib/src/asset/internal_asset.dart b/lib/src/asset/internal_asset.dart
index ead30c4..eaf5eea 100644
--- a/lib/src/asset/internal_asset.dart
+++ b/lib/src/asset/internal_asset.dart
@@ -67,7 +67,7 @@
BinaryAsset(this.id, List<int> contents) : _contents = toUint8List(contents);
Future<String> readAsString({Encoding encoding}) {
- if (encoding == null) encoding = UTF8;
+ if (encoding == null) encoding = utf8;
return new Future.value(encoding.decode(_contents));
}
@@ -115,7 +115,7 @@
FileAsset(this.id, this._path);
Future<String> readAsString({Encoding encoding}) {
- if (encoding == null) encoding = UTF8;
+ if (encoding == null) encoding = utf8;
return _pool.readAsString(_path, encoding);
}
@@ -136,7 +136,7 @@
new Future.value(_contents);
Stream<List<int>> read() =>
- new Future<List<int>>.value(UTF8.encode(_contents)).asStream();
+ new Future<List<int>>.value(utf8.encode(_contents)).asStream();
String toString() {
// Don't show the whole string if it's long.
@@ -172,7 +172,7 @@
: _replayer = new StreamReplayer(stream);
Future<String> readAsString({Encoding encoding}) {
- if (encoding == null) encoding = UTF8;
+ if (encoding == null) encoding = utf8;
return _replayer
.getReplay()
.expand((chunk) => chunk)
diff --git a/lib/src/transformer/aggregate_transform.dart b/lib/src/transformer/aggregate_transform.dart
index ce20d43..7def31b 100644
--- a/lib/src/transformer/aggregate_transform.dart
+++ b/lib/src/transformer/aggregate_transform.dart
@@ -76,11 +76,11 @@
///
/// If the asset was created from a [String] the original string is always
/// returned and [encoding] is ignored. Otherwise, the binary data of the
- /// asset is decoded using [encoding], which defaults to [UTF8].
+ /// asset is decoded using [encoding], which defaults to [utf8].
///
/// If an input with [id] cannot be found, throws an [AssetNotFoundException].
Future<String> readInputAsString(AssetId id, {Encoding encoding}) {
- if (encoding == null) encoding = UTF8;
+ if (encoding == null) encoding = utf8;
return getInput(id).then(
(input) => input.readAsString(encoding: encoding));
}
diff --git a/lib/src/transformer/transform.dart b/lib/src/transformer/transform.dart
index 8bc057a..c358582 100644
--- a/lib/src/transformer/transform.dart
+++ b/lib/src/transformer/transform.dart
@@ -67,7 +67,7 @@
///
/// If the asset was created from a [String] the original string is always
/// returned and [encoding] is ignored. Otherwise, the binary data of the
- /// asset is decoded using [encoding], which defaults to [UTF8].
+ /// asset is decoded using [encoding], which defaults to [utf8].
///
/// If an input with [id] cannot be found, throws an [AssetNotFoundException].
Future<String> readInputAsString(AssetId id, {Encoding encoding}) =>
diff --git a/lib/src/utils.dart b/lib/src/utils.dart
index c7d5555..b3e5522 100644
--- a/lib/src/utils.dart
+++ b/lib/src/utils.dart
@@ -238,7 +238,7 @@
// Future.value or Future() constructors use scheduleMicrotask themselves and
// would therefore not wait for microtask callbacks that are scheduled after
// invoking this method.
- return new Future.delayed(Duration.ZERO, () => pumpEventQueue(times - 1));
+ return new Future.delayed(Duration.zero, () => pumpEventQueue(times - 1));
}
/// Names [new Future.microtask] so that it is used consistently throughout this
diff --git a/pubspec.yaml b/pubspec.yaml
index a66e94f..e7e508d 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -7,7 +7,7 @@
#
# When the minor or patch version of this is upgraded, you *must* update that
# version constraint in pub to stay in sync with this.
-version: 0.15.2+15
+version: 0.15.2+16
author: "Dart Team <misc@dartlang.org>"
homepage: http://github.com/dart-lang/barback
@@ -32,4 +32,4 @@
scheduled_test: ">=0.9.0 <0.11.0"
unittest: ">=0.9.0 <0.10.0"
environment:
- sdk: ">=1.22.0 <2.0.0"
+ sdk: ">=2.0.0-dev.17.0 <2.0.0"
diff --git a/test/asset_test.dart b/test/asset_test.dart
index ce58229..c938604 100644
--- a/test/asset_test.dart
+++ b/test/asset_test.dart
@@ -37,7 +37,7 @@
new File(textFilePath).writeAsStringSync("çøñ†éℵ™");
latin1FilePath = pathos.join(tempDir.path, "file.latin1");
- new File(latin1FilePath).writeAsBytesSync(LATIN1.encode("blåbærgrød"));
+ new File(latin1FilePath).writeAsBytesSync(latin1.encode("blåbærgrød"));
});
tearDown(() {
@@ -86,7 +86,7 @@
test("gets the UTF-8-encoded string for a string asset", () {
var asset = new Asset.fromString(id, "çøñ†éℵ™");
expect(
- asset.read().toList(), completion(equals([UTF8.encode("çøñ†éℵ™")])));
+ asset.read().toList(), completion(equals([utf8.encode("çøñ†éℵ™")])));
});
test("gets the raw bytes for a byte asset", () {
@@ -102,28 +102,28 @@
test("gets the raw bytes for a text file", () {
var asset = new Asset.fromPath(id, textFilePath);
expect(
- asset.read().toList(), completion(equals([UTF8.encode("çøñ†éℵ™")])));
+ asset.read().toList(), completion(equals([utf8.encode("çøñ†éℵ™")])));
});
test("gets the raw bytes for a stream", () {
var asset = new Asset.fromStream(
- id, new Stream.fromFuture(new Future.value(UTF8.encode("çøñ†éℵ™"))));
+ id, new Stream.fromFuture(new Future.value(utf8.encode("çøñ†éℵ™"))));
expect(
- asset.read().toList(), completion(equals([UTF8.encode("çøñ†éℵ™")])));
+ asset.read().toList(), completion(equals([utf8.encode("çøñ†éℵ™")])));
});
});
group("readAsString()", () {
group("byte asset", () {
test("defaults to UTF-8 if encoding is omitted", () {
- var asset = new Asset.fromBytes(id, UTF8.encode("çøñ†éℵ™"));
+ var asset = new Asset.fromBytes(id, utf8.encode("çøñ†éℵ™"));
expect(asset.readAsString(), completion(equals("çøñ†éℵ™")));
});
test("supports UTF-8", () {
- var asset = new Asset.fromBytes(id, UTF8.encode("çøñ†éℵ™"));
+ var asset = new Asset.fromBytes(id, utf8.encode("çøñ†éℵ™"));
expect(
- asset.readAsString(encoding: UTF8), completion(equals("çøñ†éℵ™")));
+ asset.readAsString(encoding: utf8), completion(equals("çøñ†éℵ™")));
});
// TODO(rnystrom): Test other encodings once #6284 is fixed.
@@ -137,7 +137,7 @@
test("ignores the encoding", () {
var asset = new Asset.fromString(id, "contents");
- expect(asset.readAsString(encoding: LATIN1),
+ expect(asset.readAsString(encoding: latin1),
completion(equals("contents")));
});
});
@@ -152,21 +152,21 @@
group("stream asset", () {
test("defaults to UTF-8 if encoding is omitted", () {
var asset = new Asset.fromStream(id,
- new Stream.fromFuture(new Future.value(UTF8.encode("çøñ†éℵ™"))));
+ new Stream.fromFuture(new Future.value(utf8.encode("çøñ†éℵ™"))));
expect(asset.readAsString(), completion(equals("çøñ†éℵ™")));
});
test("supports UTF-8", () {
var asset = new Asset.fromStream(id,
- new Stream.fromFuture(new Future.value(UTF8.encode("çøñ†éℵ™"))));
+ new Stream.fromFuture(new Future.value(utf8.encode("çøñ†éℵ™"))));
expect(
- asset.readAsString(encoding: UTF8), completion(equals("çøñ†éℵ™")));
+ asset.readAsString(encoding: utf8), completion(equals("çøñ†éℵ™")));
});
test("supports ISO-8859-1", () {
- var future = new Future.value(LATIN1.encode("blåbærgrød"));
+ var future = new Future.value(latin1.encode("blåbærgrød"));
var asset = new Asset.fromStream(id, new Stream.fromFuture(future));
- expect(asset.readAsString(encoding: LATIN1),
+ expect(asset.readAsString(encoding: latin1),
completion(equals("blåbærgrød")));
});
});
@@ -223,7 +223,7 @@
test("gets the UTF-8-encoded string for a string asset", () {
var asset = new Asset.fromString(id, "çøñ†éℵ™");
expect(getBytesFromIsolate(asset),
- completion(equals(UTF8.encode("çøñ†éℵ™"))));
+ completion(equals(utf8.encode("çøñ†éℵ™"))));
});
test("gets the raw bytes for a byte asset", () {
@@ -239,14 +239,14 @@
test("gets the raw bytes for a text file", () {
var asset = new Asset.fromPath(id, textFilePath);
expect(getBytesFromIsolate(asset),
- completion(equals(UTF8.encode("çøñ†éℵ™"))));
+ completion(equals(utf8.encode("çøñ†éℵ™"))));
});
test("gets the raw bytes for a stream", () {
var asset = new Asset.fromStream(
- id, new Stream.fromFuture(new Future.value(UTF8.encode("çøñ†éℵ™"))));
+ id, new Stream.fromFuture(new Future.value(utf8.encode("çøñ†éℵ™"))));
expect(getBytesFromIsolate(asset),
- completion(equals(UTF8.encode("çøñ†éℵ™"))));
+ completion(equals(utf8.encode("çøñ†éℵ™"))));
});
});
}