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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:html'; | 6 import 'dart:html'; |
7 | 7 |
8 import 'package:mdv/mdv.dart' as mdv; | 8 import 'package:mdv/mdv.dart' as mdv; |
9 import 'package:logging/logging.dart'; | 9 import 'package:logging/logging.dart'; |
10 import 'package:observe/observe.dart'; | 10 import 'package:observe/observe.dart'; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 expect(records.length, 1); | 75 expect(records.length, 1); |
76 expect(records.first.message, | 76 expect(records.first.message, |
77 contains('Error evaluating expression')); | 77 contains('Error evaluating expression')); |
78 expect(records.first.message, contains('foo')); | 78 expect(records.first.message, contains('foo')); |
79 }); | 79 }); |
80 }); | 80 }); |
81 }); | 81 }); |
82 }); | 82 }); |
83 } | 83 } |
84 | 84 |
85 class Person extends Object with ChangeNotifierMixin { | 85 class Person extends ChangeNotifierBase { |
86 static const _FIRST_NAME = const Symbol('firstName'); | |
87 static const _LAST_NAME = const Symbol('lastName'); | |
88 static const _ITEMS = const Symbol('items'); | |
89 static const _GET_FULL_NAME = const Symbol('getFullName'); | |
90 | |
91 String _firstName; | 86 String _firstName; |
92 String _lastName; | 87 String _lastName; |
93 List<String> _items; | 88 List<String> _items; |
94 | 89 |
95 Person(this._firstName, this._lastName, this._items); | 90 Person(this._firstName, this._lastName, this._items); |
96 | 91 |
97 String get firstName => _firstName; | 92 String get firstName => _firstName; |
98 | 93 |
99 void set firstName(String value) { | 94 void set firstName(String value) { |
100 _firstName = value; | 95 _firstName = value; |
101 notifyChange(new PropertyChangeRecord(_FIRST_NAME)); | 96 notifyChange(new PropertyChangeRecord(#firstName)); |
102 } | 97 } |
103 | 98 |
104 String get lastName => _lastName; | 99 String get lastName => _lastName; |
105 | 100 |
106 void set lastName(String value) { | 101 void set lastName(String value) { |
107 _lastName = value; | 102 _lastName = value; |
108 notifyChange(new PropertyChangeRecord(_LAST_NAME)); | 103 notifyChange(new PropertyChangeRecord(#lastName)); |
109 } | 104 } |
110 | 105 |
111 String getFullName() => '$_firstName $_lastName'; | 106 String getFullName() => '$_firstName $_lastName'; |
112 | 107 |
113 List<String> get items => _items; | 108 List<String> get items => _items; |
114 | 109 |
115 void set items(List<String> value) { | 110 void set items(List<String> value) { |
116 _items = value; | 111 _items = value; |
117 notifyChange(new PropertyChangeRecord(_ITEMS)); | 112 notifyChange(new PropertyChangeRecord(#items)); |
118 } | 113 } |
119 | 114 |
120 String toString() => "Person(firstName: $_firstName, lastName: $_lastName)"; | 115 String toString() => "Person(firstName: $_firstName, lastName: $_lastName)"; |
121 | 116 |
122 } | 117 } |
OLD | NEW |