-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[macros] Add standalone program for the example observable macro (#3578)
* add standalone observable example * update to latest SDK * update analyzer excludes
- Loading branch information
Showing
3 changed files
with
39 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import 'package:macro_proposal/observable.dart'; | ||
|
||
void main() { | ||
var jack = ObservableUser(age: 10, name: 'jack'); | ||
jack.age = 12; | ||
jack.name = 'john'; | ||
} | ||
|
||
class ObservableUser { | ||
@Observable() | ||
int _age; | ||
|
||
@Observable() | ||
String _name; | ||
|
||
ObservableUser({ | ||
required int age, | ||
required String name, | ||
}) : _age = age, | ||
_name = name; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters