Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 1.0.0-beta+2

- BREAKING CHANGE: `MethodModifier.async`, `MethodModifier.asyncStar` and
`MethodModifier.syncStar` are now `MethodModifier.asAsync`,
`MethodModifier.asAsyncStar` and `MethodModifier.asSyncStar`

## 1.0.0-beta+1

- Add support for `switch` statements
Expand Down
7 changes: 4 additions & 3 deletions lib/src/builders/method.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ ConstructorBuilder constructorNamed(

/// Various types of modifiers for methods.
class MethodModifier implements ValidMethodMember {
static const MethodModifier async = const MethodModifier._('async', false);
static const MethodModifier asyncStar = const MethodModifier._('async', true);
static const MethodModifier syncStar = const MethodModifier._('sync', true);
static const MethodModifier asAsync = const MethodModifier._('async', false);
static const MethodModifier asAsyncStar =
const MethodModifier._('async', true);
static const MethodModifier asSyncStar = const MethodModifier._('sync', true);

final String _keyword;

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: code_builder
version: 1.0.0-beta+1
version: 1.0.0-beta+2
description: A fluent API for generating Dart code
author: Dart Team <misc@dartlang.org>
homepage: https://github.com/dart-lang/code_builder
Expand Down
6 changes: 3 additions & 3 deletions test/builders/method_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ void main() {

test('should emit an async method', () {
expect(
method('fetch', [MethodModifier.async]),
method('fetch', [MethodModifier.asAsync]),
equalsSource(r'''
fetch() async {}
'''),
Expand All @@ -181,7 +181,7 @@ void main() {

test('should emit an async* method', () {
expect(
method('fetch', [MethodModifier.asyncStar]),
method('fetch', [MethodModifier.asAsyncStar]),
equalsSource(r'''
fetch() async* {}
'''),
Expand All @@ -190,7 +190,7 @@ void main() {

test('should emit an sync* method', () {
expect(
method('fetch', [MethodModifier.syncStar]),
method('fetch', [MethodModifier.asSyncStar]),
equalsSource(r'''
fetch() sync* {}
'''),
Expand Down