| 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 part of observe; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Represents an observable list of model values. If any items are added, | 8 * Represents an observable list of model values. If any items are added, |
| 9 * removed, or replaced, then observers that are listening to [changes] | 9 * removed, or replaced, then observers that are listening to [changes] |
| 10 * will be notified. | 10 * will be notified. |
| 11 */ | 11 */ |
| 12 class ObservableList<E> extends ListBase<E> with ChangeNotifierMixin { | 12 class ObservableList<E> extends ListBase<E> with ChangeNotifier { |
| 13 List<ListChangeRecord> _listRecords; | 13 List<ListChangeRecord> _listRecords; |
| 14 | 14 |
| 15 /** The inner [List<E>] with the actual storage. */ | 15 /** The inner [List<E>] with the actual storage. */ |
| 16 final List<E> _list; | 16 final List<E> _list; |
| 17 | 17 |
| 18 /** | 18 /** |
| 19 * Creates an observable list of the given [length]. | 19 * Creates an observable list of the given [length]. |
| 20 * | 20 * |
| 21 * If no [length] argument is supplied an extendable list of | 21 * If no [length] argument is supplied an extendable list of |
| 22 * length 0 is created. | 22 * length 0 is created. |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 271 |
| 272 if (added > 0 || removed > 0) { | 272 if (added > 0 || removed > 0) { |
| 273 notifyChange(new ListChangeRecord(startIndex, addedCount: added, | 273 notifyChange(new ListChangeRecord(startIndex, addedCount: added, |
| 274 removedCount: removed)); | 274 removedCount: removed)); |
| 275 } | 275 } |
| 276 | 276 |
| 277 offset += removed - added; | 277 offset += removed - added; |
| 278 } | 278 } |
| 279 } | 279 } |
| 280 } | 280 } |
| OLD | NEW |