leancodepl / leancodepl/bloc_presentation
Please consider about rename this package to bloc_reactions
Nobody has claimed this yet.
- Dominant language
- Dart
- Stars
- 34
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
First I`ve seen this package i thought this is one of dosents packages that provides context and flutter imports in bloc, but after reading source i liked idea very much!
Please consider to rename BlocPresentrationMixin -> BlocReactionMixin, because it`s a non presentation Stream of generics, here is some of my thoughts
/// This is bloc events
@freezed
sealed class SettingsEvent with _$SettingsEvent {
const factory SettingsEvent.init() = Init;
const factory SettingsEvent.readSetting() = ReadSetting;
const factory SettingsEvent.updateSetting({
required SettingsEntity settings,
}) = WriteSetting;
}
/// This is bloc reactions
@freezed
sealed class SettingsReactions with _$SettingsReactions {
const factory SettingsReactions.reactSuccess() = ReactSuccess;
const factory SettingsReactions.reactFailure() = ReactFailure;
}
and in ui listen to reactions
BlocPresentationListener<SettingsBloc, SettingsReactions>(
listener: (context, reaction) {
switch (reaction) {
case ReactSuccess():
ScaffoldMessenger.of(
context,
).showSnackBar(const SnackBar(content: Text('Success')));
break;
case ReactFailure():
showDialog<void>(
context: context,
builder: (context) => const AlertDialog(),
);
}
},
child:
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the package source around BlocPresentrationMixin and the BlocPresentationListener API shown in the issue, then determine the full scope of the proposed package and terminology rename. Done means the maintainers have agreed on the naming and all affected public references and examples use the selected names consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter
- Domain
- frontend
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100