Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(bloc): Add const constructor to BlocObserver #3704

Merged

Conversation

ValentinVignal
Copy link
Contributor

Status

READY

Breaking Changes

NO

Description

Fixes #3703 by adding a const constructor to BlocObserver

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

@ValentinVignal
Copy link
Contributor Author

Should I do a first PR to add the const constructor and only modify the examples once released?

@@ -3,6 +3,9 @@ import 'package:meta/meta.dart';

/// An interface for observing the behavior of [Bloc] instances.
abstract class BlocObserver {
/// An interface for observing the behavior of [Bloc] instances.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we create a template and use a macro here instead of copy/pasting the same documentation?

runApp(const App());
}

/// Custom [BlocObserver] that observes all bloc and cubit state changes.
class AppBlocObserver extends BlocObserver {
/// Custom [BlocObserver] that observes all bloc and cubit state changes.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we create a template and use a macro here to avoid duplicating the documentation?

runApp(const App());
}

/// Custom [BlocObserver] that observes all bloc and cubit state changes.
class AppBlocObserver extends BlocObserver {
/// Custom [BlocObserver] that observes all bloc and cubit state changes.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we create a template and use a macro here to avoid duplicating the documentation?

@felangel felangel added the enhancement New feature or request label Feb 2, 2023
@codecov
Copy link

codecov bot commented Feb 2, 2023

Codecov Report

Base: 100.00% // Head: 100.00% // No change to project coverage 👍

Coverage data is based on head (5b71a20) compared to base (7330745).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #3704   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            3         8    +5     
  Lines          158       198   +40     
=========================================
+ Hits           158       198   +40     
Impacted Files Coverage Δ
packages/bloc/lib/src/bloc.dart 100.00% <100.00%> (ø)
packages/bloc/lib/src/bloc_observer.dart 100.00% <100.00%> (ø)
...ackages/hydrated_bloc/lib/src/hydrated_cipher.dart
packages/hydrated_bloc/lib/src/hydrated_bloc.dart
...ckages/hydrated_bloc/lib/src/hydrated_storage.dart
packages/bloc/lib/src/bloc_base.dart 100.00% <0.00%> (ø)
packages/bloc/lib/src/transition.dart 100.00% <0.00%> (ø)
packages/bloc/lib/src/change.dart 100.00% <0.00%> (ø)
packages/bloc/lib/src/bloc_overrides.dart 100.00% <0.00%> (ø)
... and 3 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ValentinVignal
Copy link
Contributor Author

@felangel I reverted the changes on the other packages than bloc. I guess it needs to wait for this PR to be merged and deployed before I can do another PR to update the other packages and examples?

Copy link
Owner

@felangel felangel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks so much for the contribution! 💯

@felangel felangel merged commit 34a03b6 into felangel:master Feb 5, 2023
@felangel felangel mentioned this pull request Feb 5, 2023
7 tasks
@ValentinVignal ValentinVignal deleted the refactor/bloc-observer-as-const branch February 6, 2023 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

refactor: BlocObserver could have a const constructor
2 participants