Make the package strong-mode clean.
R=rnystrom@google.com, lrn@google.com
Review URL: https://codereview.chromium.org//1912273003 .
diff --git a/.analysis_options b/.analysis_options
new file mode 100644
index 0000000..a10d4c5
--- /dev/null
+++ b/.analysis_options
@@ -0,0 +1,2 @@
+analyzer:
+ strong-mode: true
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 88ee3b2..19fbce6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 1.1.1
+
+* Fix all strong-mode warnings.
+
## 1.1.0
* Add `AccumulatorSink`, `ByteAccumulatorSink`, and `StringAccumulatorSink`
diff --git a/lib/src/hex/decoder.dart b/lib/src/hex/decoder.dart
index efb0b0d..6a31641 100644
--- a/lib/src/hex/decoder.dart
+++ b/lib/src/hex/decoder.dart
@@ -17,7 +17,8 @@
/// Because two hexadecimal digits correspond to a single byte, this will throw
/// a [FormatException] if given an odd-length string. It will also throw a
/// [FormatException] if given a string containing non-hexadecimal code units.
-class HexDecoder extends Converter<String, List<int>> {
+class HexDecoder
+ extends ChunkedConverter<String, List<int>, String, List<int>> {
const HexDecoder._();
List<int> convert(String string) {
@@ -58,8 +59,8 @@
}
var codeUnits = string.codeUnits;
- var bytes;
- var bytesStart;
+ Uint8List bytes;
+ int bytesStart;
if (_lastDigit == null) {
bytes = new Uint8List((end - start) ~/ 2);
bytesStart = 0;
@@ -118,8 +119,8 @@
return;
}
- var bytes;
- var bytesStart;
+ Uint8List bytes;
+ int bytesStart;
if (_lastDigit == null) {
bytes = new Uint8List((end - start) ~/ 2);
bytesStart = 0;
diff --git a/lib/src/hex/encoder.dart b/lib/src/hex/encoder.dart
index a9c66a5..ee53dd7 100644
--- a/lib/src/hex/encoder.dart
+++ b/lib/src/hex/encoder.dart
@@ -16,7 +16,8 @@
///
/// This will throw a [RangeError] if the byte array has any digits that don't
/// fit in the gamut of a byte.
-class HexEncoder extends Converter<List<int>, String> {
+class HexEncoder
+ extends ChunkedConverter<List<int>, String, List<int>, String> {
const HexEncoder._();
String convert(List<int> bytes) => _convert(bytes, 0, bytes.length);
diff --git a/lib/src/percent/decoder.dart b/lib/src/percent/decoder.dart
index 4d8f994..3ff3e01 100644
--- a/lib/src/percent/decoder.dart
+++ b/lib/src/percent/decoder.dart
@@ -25,7 +25,8 @@
///
/// This will throw a [FormatException] if the input string has an incomplete
/// percent-encoding, or if it contains non-ASCII code units.
-class PercentDecoder extends Converter<String, List<int>> {
+class PercentDecoder
+ extends ChunkedConverter<String, List<int>, String, List<int>> {
const PercentDecoder._();
List<int> convert(String string) {
diff --git a/lib/src/percent/encoder.dart b/lib/src/percent/encoder.dart
index c781760..b4cf1a1 100644
--- a/lib/src/percent/encoder.dart
+++ b/lib/src/percent/encoder.dart
@@ -19,7 +19,8 @@
///
/// This will throw a [RangeError] if the byte array has any digits that don't
/// fit in the gamut of a byte.
-class PercentEncoder extends Converter<List<int>, String> {
+class PercentEncoder
+ extends ChunkedConverter<List<int>, String, List<int>, String> {
const PercentEncoder._();
String convert(List<int> bytes) => _convert(bytes, 0, bytes.length);
diff --git a/pubspec.yaml b/pubspec.yaml
index c70ea39..94315e0 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,11 +1,11 @@
name: convert
-version: 1.1.0
+version: 1.1.1
description: Utilities for converting between data representations.
author: Dart Team <misc@dartlang.org>
homepage: https://github.com/dart-lang/convert
environment:
- sdk: '>=1.8.0 <2.0.0'
+ sdk: '>=1.16.0 <2.0.0'
dependencies:
charcode: '^1.1.0'
diff --git a/test/accumulator_sink_test.dart b/test/accumulator_sink_test.dart
index b0312f1..81fe1db 100644
--- a/test/accumulator_sink_test.dart
+++ b/test/accumulator_sink_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import 'dart:async';
-
import 'package:convert/convert.dart';
import 'package:test/test.dart';
diff --git a/test/byte_accumulator_sink_test.dart b/test/byte_accumulator_sink_test.dart
index 27c043e..123baa8 100644
--- a/test/byte_accumulator_sink_test.dart
+++ b/test/byte_accumulator_sink_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import 'dart:async';
-
import 'package:convert/convert.dart';
import 'package:test/test.dart';
diff --git a/test/hex_test.dart b/test/hex_test.dart
index f52edaf..837085f 100644
--- a/test/hex_test.dart
+++ b/test/hex_test.dart
@@ -16,8 +16,8 @@
group("with chunked conversion", () {
test("converts byte arrays to hex", () {
- var results = [];
- var controller = new StreamController(sync: true);
+ var results = <String>[];
+ var controller = new StreamController<String>(sync: true);
controller.stream.listen(results.add);
var sink = hex.encoder.startChunkedConversion(controller.sink);
@@ -29,8 +29,8 @@
});
test("handles empty and single-byte lists", () {
- var results = [];
- var controller = new StreamController(sync: true);
+ var results = <String>[];
+ var controller = new StreamController<String>(sync: true);
controller.stream.listen(results.add);
var sink = hex.encoder.startChunkedConversion(controller.sink);
@@ -67,11 +67,11 @@
});
group("with chunked conversion", () {
- var results;
+ List<List<int>> results;
var sink;
setUp(() {
results = [];
- var controller = new StreamController(sync: true);
+ var controller = new StreamController<List<int>>(sync: true);
controller.stream.listen(results.add);
sink = hex.decoder.startChunkedConversion(controller.sink);
});
diff --git a/test/percent_test.dart b/test/percent_test.dart
index f7a1c48..7a1daca 100644
--- a/test/percent_test.dart
+++ b/test/percent_test.dart
@@ -37,8 +37,8 @@
group("with chunked conversion", () {
test("percent-encodes byte arrays", () {
- var results = [];
- var controller = new StreamController(sync: true);
+ var results = <String>[];
+ var controller = new StreamController<String>(sync: true);
controller.stream.listen(results.add);
var sink = percent.encoder.startChunkedConversion(controller.sink);
@@ -50,8 +50,8 @@
});
test("handles empty and single-byte lists", () {
- var results = [];
- var controller = new StreamController(sync: true);
+ var results = <String>[];
+ var controller = new StreamController<String>(sync: true);
controller.stream.listen(results.add);
var sink = percent.encoder.startChunkedConversion(controller.sink);
@@ -98,11 +98,11 @@
});
group("with chunked conversion", () {
- var results;
+ List<List<int>> results;
var sink;
setUp(() {
results = [];
- var controller = new StreamController(sync: true);
+ var controller = new StreamController<List<int>>(sync: true);
controller.stream.listen(results.add);
sink = percent.decoder.startChunkedConversion(controller.sink);
});
diff --git a/test/string_accumulator_sink_test.dart b/test/string_accumulator_sink_test.dart
index e6e30e6..914dd93 100644
--- a/test/string_accumulator_sink_test.dart
+++ b/test/string_accumulator_sink_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import 'dart:async';
-
import 'package:convert/convert.dart';
import 'package:test/test.dart';