Simplify some types used in is checks and correct PbList to match the typical signature used by the setRange method.
BUG=
R=cbracken@google.com
Review URL: https://chromiumcodereview.appspot.com//876463003
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9e46b66..c1d564d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.3.5+2
+ * Simplify some types used in is checks and correct PbList to match the
+ * signature of the List setRange method.
+
## 0.3.5+1
* Bugfix for incorrect decoding of protobuf messages: Uint8List views with
diff --git a/lib/src/protobuf/generated_message.dart b/lib/src/protobuf/generated_message.dart
index 7686603..ac4b74b 100644
--- a/lib/src/protobuf/generated_message.dart
+++ b/lib/src/protobuf/generated_message.dart
@@ -826,7 +826,7 @@
break;
case _GROUP_BIT:
case _MESSAGE_BIT:
- if (value is Map<String, Object>) {
+ if (value is Map) {
GeneratedMessage subMessage =
_getEmptyMessage(tagNumber, extensionRegistry);
subMessage._mergeFromJson(value, extensionRegistry);
@@ -1083,9 +1083,9 @@
}
break;
case _BYTES_BIT:
- if (value is !List<int>) {
+ if (value is !List) {
throw new ArgumentError(
- _generateMessage(tagNumber, value, 'not List<int>'));
+ _generateMessage(tagNumber, value, 'not List'));
}
break;
case _STRING_BIT:
diff --git a/lib/src/protobuf/pb_list.dart b/lib/src/protobuf/pb_list.dart
index 3948244..e2b518d 100644
--- a/lib/src/protobuf/pb_list.dart
+++ b/lib/src/protobuf/pb_list.dart
@@ -87,7 +87,7 @@
* Throws an [UnsupportedError] if the list is
* not extendable.
*/
- void setRange(int start, int end, List<E> from, [int skipCount = 0]) {
+ void setRange(int start, int end, Iterable<E> from, [int skipCount = 0]) {
from.sublist(skipCount, skipCount + end - start).forEach(_validate);
_wrappedList.setRange(start, end, from, skipCount);
}
diff --git a/pubspec.yaml b/pubspec.yaml
index 447a14d..6e9c38e 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: protobuf
-version: 0.3.5+1
+version: 0.3.5+2
author: Dart Team <misc@dartlang.org>
description: Runtime library for protobuf support.
homepage: https://github.com/dart-lang/dart-protobuf