| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of observe; | 5 library observe.src.observable_list; |
| 6 |
| 7 import 'dart:async'; |
| 8 import 'dart:collection' show ListBase; |
| 9 import 'package:observe/observe.dart'; |
| 6 | 10 |
| 7 /** | 11 /** |
| 8 * Represents an observable list of model values. If any items are added, | 12 * Represents an observable list of model values. If any items are added, |
| 9 * removed, or replaced, then observers that are listening to [changes] | 13 * removed, or replaced, then observers that are listening to [changes] |
| 10 * will be notified. | 14 * will be notified. |
| 11 */ | 15 */ |
| 12 class ObservableList<E> extends ListBase<E> with ChangeNotifier { | 16 class ObservableList<E> extends ListBase<E> with ChangeNotifier { |
| 13 List<ListChangeRecord> _listRecords; | 17 List<ListChangeRecord> _listRecords; |
| 14 | 18 |
| 15 /** The inner [List<E>] with the actual storage. */ | 19 /** The inner [List<E>] with the actual storage. */ |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 275 |
| 272 if (added > 0 || removed > 0) { | 276 if (added > 0 || removed > 0) { |
| 273 notifyChange(new ListChangeRecord(startIndex, addedCount: added, | 277 notifyChange(new ListChangeRecord(startIndex, addedCount: added, |
| 274 removedCount: removed)); | 278 removedCount: removed)); |
| 275 } | 279 } |
| 276 | 280 |
| 277 offset += removed - added; | 281 offset += removed - added; |
| 278 } | 282 } |
| 279 } | 283 } |
| 280 } | 284 } |
| OLD | NEW |