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(flutter_bloc)!: remove package:provider #1880

Merged
merged 14 commits into from Nov 4, 2020

Conversation

felangel
Copy link
Owner

@felangel felangel commented Nov 3, 2020

Status

READY

Breaking Changes

YES

Explanation

This refactor technically is a breaking change because previously it was possible to use Provider.of and context.read with bloc/cubit instances. In addition, it was previously possible to import package:provider/provider.dart as a transitive dependency.

Migration

  • Provider.of<MyBloc>(context, listen: ...) -> BlocProvider.of<MyBloc>(context)
  • context.read<MyBloc>() -> context.bloc<MyBloc>()

If you were previously importing package:provider/provider.dart please ensure it is a direct dependency by adding it to the dependencies section of your pubspec.yaml

flutter_bloc: ^6.0.6
provider: ^4.3.2+2 # make sure to add this if you directly import package:provider/provider.dart

Description

Feedback Wanted

You can give these changes a try by updating your pubspec.yaml

  flutter_bloc:
    git:
      url: https://github.com/felangel/bloc
      ref: refactor/remove-provider-dependency
      path: packages/flutter_bloc

There should be no noticeable difference or breaking changes unless you are using Provider.of or context.read to interact with bloc/cubit instances.

If you experience any issues please leave a comment describing the problem, thanks! ๐Ÿ™

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

@felangel felangel added feedback wanted Looking for feedback from the community pkg:flutter_bloc This issue is related to the flutter_bloc package refactor Refactor an existing implementation labels Nov 3, 2020
@felangel felangel self-assigned this Nov 3, 2020
@felangel felangel added this to In progress in bloc via automation Nov 3, 2020
@codecov
Copy link

codecov bot commented Nov 3, 2020

Codecov Report

Merging #1880 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##            master     #1880    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           17         8     -9     
  Lines          282       172   -110     
==========================================
- Hits           282       172   -110     
Impacted Files Coverage ฮ”
packages/flutter_bloc/lib/src/bloc_listener.dart 100.00% <รธ> (รธ)
packages/flutter_bloc/lib/src/bloc_provider.dart 100.00% <100.00%> (รธ)
...ages/flutter_bloc/lib/src/multi_bloc_listener.dart 100.00% <100.00%> (รธ)
...ages/flutter_bloc/lib/src/multi_bloc_provider.dart 100.00% <100.00%> (รธ)
...lutter_bloc/lib/src/multi_repository_provider.dart 100.00% <100.00%> (รธ)
...ages/flutter_bloc/lib/src/repository_provider.dart 100.00% <100.00%> (รธ)
packages/bloc/lib/src/cubit.dart
packages/bloc/lib/src/change.dart
packages/bloc/lib/src/transition.dart
packages/bloc_test/lib/src/bloc_test.dart
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
ฮ” = absolute <relative> (impact), รธ = not affected, ? = missing data
Powered by Codecov. Last update 10805eb...28a34f0. Read the comment docs.

@felangel felangel force-pushed the refactor/remove-provider-dependency branch 2 times, most recently from 61e5dc5 to 9599318 Compare November 3, 2020 03:48
@felangel felangel force-pushed the refactor/remove-provider-dependency branch from 9599318 to d29dd02 Compare November 3, 2020 03:51
@felangel felangel added the dependency This issue has an external dependency label Nov 3, 2020
@felangel felangel changed the title refactor: remove package:provider refactor(flutter_bloc): remove package:provider Nov 3, 2020
@felangel felangel added the breaking change Enhancement candidate would introduce a breaking change label Nov 4, 2020
@felangel felangel changed the title refactor(flutter_bloc): remove package:provider refactor(flutter_bloc)!: remove package:provider Nov 4, 2020
@felangel felangel marked this pull request as ready for review November 4, 2020 21:32
Copy link
Collaborator

@jorgecoca jorgecoca left a comment

Choose a reason for hiding this comment

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

๐Ÿšข ๐Ÿ‡ฎ๐Ÿ‡น

@felangel felangel merged commit 9f99cd2 into master Nov 4, 2020
bloc automation moved this from In progress to Done Nov 4, 2020
@felangel felangel deleted the refactor/remove-provider-dependency branch November 4, 2020 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Enhancement candidate would introduce a breaking change dependency This issue has an external dependency feedback wanted Looking for feedback from the community pkg:flutter_bloc This issue is related to the flutter_bloc package refactor Refactor an existing implementation
Projects
bloc
  
Done
Development

Successfully merging this pull request may close these issues.

[Discussion] Maintaining Provider Dependency
5 participants