| 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 library person; | 5 library person; |
| 6 | 6 |
| 7 import 'package:observe/observe.dart'; | 7 import 'package:observe/observe.dart'; |
| 8 | 8 |
| 9 class Person extends ChangeNotifierBase { | 9 class Person extends ChangeNotifierBase { |
| 10 static const _FIRST_NAME = const Symbol('firstName'); | 10 \ String _firstName; |
| 11 static const _LAST_NAME = const Symbol('lastName'); | |
| 12 static const _ITEMS = const Symbol('items'); | |
| 13 static const _GET_FULL_NAME = const Symbol('getFullName'); | |
| 14 | |
| 15 String _firstName; | |
| 16 String _lastName; | 11 String _lastName; |
| 17 List<String> _items; | 12 List<String> _items; |
| 18 | 13 |
| 19 Person(this._firstName, this._lastName, this._items); | 14 Person(this._firstName, this._lastName, this._items); |
| 20 | 15 |
| 21 String get firstName => _firstName; | 16 String get firstName => _firstName; |
| 22 | 17 |
| 23 void set firstName(String value) { | 18 void set firstName(String value) { |
| 24 _firstName = value; | 19 _firstName = value; |
| 25 notifyChange(new PropertyChangeRecord(_FIRST_NAME)); | 20 notifyChange(new PropertyChangeRecord(#firstName)); |
| 26 } | 21 } |
| 27 | 22 |
| 28 String get lastName => _lastName; | 23 String get lastName => _lastName; |
| 29 | 24 |
| 30 void set lastName(String value) { | 25 void set lastName(String value) { |
| 31 _lastName = value; | 26 _lastName = value; |
| 32 notifyChange(new PropertyChangeRecord(_LAST_NAME)); | 27 notifyChange(new PropertyChangeRecord(#lastName)); |
| 33 } | 28 } |
| 34 | 29 |
| 35 String getFullName() => '$_firstName $_lastName'; | 30 String getFullName() => '$_firstName $_lastName'; |
| 36 | 31 |
| 37 List<String> get items => _items; | 32 List<String> get items => _items; |
| 38 | 33 |
| 39 void set items(List<String> value) { | 34 void set items(List<String> value) { |
| 40 _items = value; | 35 _items = value; |
| 41 notifyChange(new PropertyChangeRecord(_ITEMS)); | 36 notifyChange(new PropertyChangeRecord(#items)); |
| 42 } | 37 } |
| 43 | 38 |
| 44 String toString() => "Person(firstName: $_firstName, lastName: $_lastName)"; | 39 String toString() => "Person(firstName: $_firstName, lastName: $_lastName)"; |
| 45 | 40 |
| 46 } | 41 } |
| OLD | NEW |