Skip to content

Commit

Permalink
Fix Dart2 runtime errors in tests
Browse files Browse the repository at this point in the history
Fixes #67
  • Loading branch information
nshahan authored May 3, 2018
1 parent ecfc06d commit 1174dec
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.22.1+1

* Fixes for Dart2 runtime type errors.

## 0.22.1

* Added `ObservableList.castFrom`, similar to `List.castFrom`.
Expand Down
2 changes: 1 addition & 1 deletion lib/src/observable_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ class ObservableList<E> extends ListBase<E> with Observable {

void _notifyListChange(
int index, {
List<E> removed: const [],
List<E> removed,
int addedCount: 0,
}) {
if (!hasListObservers) return;
Expand Down
7 changes: 4 additions & 3 deletions lib/src/records/list_change_record.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,16 @@ class ListChangeRecord<E> implements ChangeRecord {
factory ListChangeRecord(
List<E> object,
int index, {
List<E> removed: const [],
List<E> removed,
int addedCount: 0,
}) {
return new ListChangeRecord._(object, index, removed, addedCount);
return new ListChangeRecord._(
object, index, removed ?? new UnmodifiableListView([]), addedCount);
}

/// Records an `add` operation at `object[index]` of [addedCount] elements.
ListChangeRecord.add(this.object, this.index, this.addedCount)
: removed = const [] {
: removed = new UnmodifiableListView([]) {
_assertValidState();
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: observable
version: 0.22.1
version: 0.22.1+1
author: Dart Team <[email protected]>
description: Support for marking objects as observable
homepage: https://github.com/dart-lang/observable
Expand Down

0 comments on commit 1174dec

Please sign in to comment.