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 ChangeNotifier { |
10 String _firstName; | 10 String _firstName; |
11 String _lastName; | 11 String _lastName; |
12 List<String> _items; | 12 List<String> _items; |
13 | 13 |
14 Person(this._firstName, this._lastName, this._items); | 14 Person(this._firstName, this._lastName, this._items); |
15 | 15 |
16 String get firstName => _firstName; | 16 String get firstName => _firstName; |
17 | 17 |
18 void set firstName(String value) { | 18 void set firstName(String value) { |
19 _firstName = notifyPropertyChange(#firstName, _firstName, value); | 19 _firstName = notifyPropertyChange(#firstName, _firstName, value); |
20 } | 20 } |
21 | 21 |
22 String get lastName => _lastName; | 22 String get lastName => _lastName; |
23 | 23 |
24 void set lastName(String value) { | 24 void set lastName(String value) { |
25 _lastName = notifyPropertyChange(#lastName, _lastName, value); | 25 _lastName = notifyPropertyChange(#lastName, _lastName, value); |
26 } | 26 } |
27 | 27 |
28 String getFullName() => '$_firstName $_lastName'; | 28 String getFullName() => '$_firstName $_lastName'; |
29 | 29 |
30 List<String> get items => _items; | 30 List<String> get items => _items; |
31 | 31 |
32 void set items(List<String> value) { | 32 void set items(List<String> value) { |
33 _items = notifyPropertyChange(#items, _items, value); | 33 _items = notifyPropertyChange(#items, _items, value); |
34 } | 34 } |
35 | 35 |
36 String toString() => "Person(firstName: $_firstName, lastName: $_lastName)"; | 36 String toString() => "Person(firstName: $_firstName, lastName: $_lastName)"; |
37 } | 37 } |
OLD | NEW |