leancodepl / leancodepl/bloc_presentation

Please consider about rename this package to bloc_reactions

Open
#48 1 comment 6 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.