Skip to content

Commit

Permalink
chore(bricks): flutter_bloc_feature v0.3.0 (#3891)
Browse files Browse the repository at this point in the history
  • Loading branch information
felangel authored Jun 28, 2023
1 parent 797f2ca commit 0c52200
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 5 deletions.
5 changes: 5 additions & 0 deletions bricks/flutter_bloc_feature/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 0.3.0

- feat: upgrade to Dart 3.0
- use `sealed` classes for bloc events

# 0.2.1

- fix: upgrade to mason v0.1.0-dev.40
Expand Down
2 changes: 1 addition & 1 deletion bricks/flutter_bloc_feature/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Felix Angelov
Copyright (c) 2023 Felix Angelov

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion bricks/flutter_bloc_feature/brick.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: flutter_bloc_feature
description: Generate a new Flutter feature with bloc. Built for the bloc state management library.
repository: https://github.com/felangel/bloc/tree/master/bricks/flutter_bloc_feature
version: 0.2.1
version: 0.3.0

environment:
mason: ">=0.1.0-dev.40 <0.1.0"
Expand Down
18 changes: 16 additions & 2 deletions bricks/flutter_bloc_feature/hooks/pre_gen.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// ignore_for_file: constant_identifier_names

import 'dart:io';

import 'package:mason/mason.dart';
Expand All @@ -12,12 +14,24 @@ enum BlocType {
replay_cubit,
}

final brickVersions = {
BlocType.bloc: '^0.3.0',
BlocType.cubit: '^0.2.0',
BlocType.hydrated_bloc: '^0.3.0',
BlocType.hydrated_cubit: '^0.2.0',
BlocType.replay_bloc: '^0.2.0',
BlocType.replay_cubit: '^0.2.0',
};

Future<void> run(HookContext context) async {
final blocType = _blocTypeFromContext(context);
final progress = context.logger.progress('Making brick ${blocType.name}');
final name = context.vars['name'] as String;
final style = context.vars['style'] as String;
final brick = Brick.version(name: blocType.name, version: '^0.2.0');
final brick = Brick.version(
name: blocType.name,
version: brickVersions[blocType]!,
);
final generator = await MasonGenerator.fromBrick(brick);
final blocDirectoryName = blocType.toDirectoryName();
final directory = Directory(
Expand All @@ -34,7 +48,7 @@ Future<void> run(HookContext context) async {
);
await generator.hooks.postGen(vars: vars);
final blocExport =
'./${blocDirectoryName}/${name.snakeCase}_${blocDirectoryName}.dart';
'./$blocDirectoryName/${name.snakeCase}_$blocDirectoryName.dart';
progress.complete('Made brick ${blocType.name}');
context.logger.logFilesGenerated(files.length);
context.vars = {
Expand Down
2 changes: 1 addition & 1 deletion bricks/flutter_bloc_feature/hooks/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: flutter_bloc_feature_hooks

environment:
sdk: ">=2.12.0 <3.0.0"
sdk: ">=2.15.0 <3.0.0"

dependencies:
mason: ^0.1.0-dev.40
Expand Down

0 comments on commit 0c52200

Please sign in to comment.