Skip to content

Commit

Permalink
refactor(bricks): upgrade bloc to shorthand lambda syntax (#3320)
Browse files Browse the repository at this point in the history
  • Loading branch information
felangel authored Apr 10, 2022
1 parent 4b8e2f4 commit b718cbd
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 25 deletions.
4 changes: 4 additions & 0 deletions bricks/bloc/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.1.1

- refactor: upgrade to shorthand lambda syntax (`mason >= 0.1.0-dev.15`)

# 0.1.0

- feat: initial release with support for basic bloc generation

This file was deleted.

This file was deleted.

This file was deleted.

12 changes: 12 additions & 0 deletions bricks/bloc/__brick__/{{name.snakeCase()}}_bloc.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import 'package:bloc/bloc.dart';

part '{{name.snakeCase()}}_event.dart';
part '{{name.snakeCase()}}_state.dart';

class {{name.pascalCase()}}Bloc extends Bloc<{{name.pascalCase()}}Event, {{name.pascalCase()}}State> {
{{name.pascalCase()}}Bloc() : super(const {{name.pascalCase()}}State()) {
on<{{name.pascalCase()}}Event>((event, emit) {
// TODO: implement event handler
});
}
}
5 changes: 5 additions & 0 deletions bricks/bloc/__brick__/{{name.snakeCase()}}_event.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
part of '{{name.snakeCase()}}_bloc.dart';

abstract class {{name.pascalCase()}}Event {
const {{name.pascalCase()}}Event();
}
5 changes: 5 additions & 0 deletions bricks/bloc/__brick__/{{name.snakeCase()}}_state.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
part of '{{name.snakeCase()}}_bloc.dart';

class {{name.pascalCase()}}State {
const {{name.pascalCase()}}State();
}
6 changes: 3 additions & 3 deletions bricks/bloc/brick.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: bloc
description: Generate a new Bloc in Dart | Built for the bloc state management library.
version: 0.1.0
description: Generate a new Bloc in Dart. Built for the bloc state management library.
version: 0.1.1
repository: https://github.com/felangel/bloc/tree/master/bricks/bloc

environment:
mason: ">=0.1.0-dev <0.1.0"
mason: ">=0.1.0-dev.15 <0.1.0"

vars:
name:
Expand Down

0 comments on commit b718cbd

Please sign in to comment.