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

Fix MultiBlocProvider and MultiRepositoryProvider type inference #773

Merged
merged 1 commit into from
Jan 11, 2020

Conversation

felangel
Copy link
Owner

Status

READY

Breaking Changes

NO

Description

As a developer, I shouldn't need to provider the Bloc/Repository type explicitly when using MultiBlocProvider, MultiBlocListener, or MultiRepositoryProvider.

MultiBlocProvider(
  providers: [
    BlocProvider<BlocA>(
      create: (_) => BlocA(),
    ),
    BlocProvider<BlocB>(
      create: (_) => BlocB(),
    ),
    child: MyChild(),
);

Instead, I should be able to omit the type and have it be correctly inferred:

MultiBlocProvider(
  providers: [
    BlocProvider(
      create: (_) => BlocA(),
    ),
    BlocProvider(
      create: (_) => BlocB(),
    ),
    child: MyChild(),
);

Todos

  • Tests
  • Documentation
  • Examples

Impact to Remaining Code Base

  • Enhancement to be included in flutter_bloc 3.2.0

@felangel felangel added enhancement New feature or request pkg:flutter_bloc This issue is related to the flutter_bloc package labels Jan 11, 2020
@felangel felangel self-assigned this Jan 11, 2020
@codecov
Copy link

codecov bot commented Jan 11, 2020

Codecov Report

Merging #773 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #773   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          16     16           
  Lines         238    238           
=====================================
  Hits          238    238
Impacted Files Coverage Δ
...ages/flutter_bloc/lib/src/repository_provider.dart 100% <ø> (ø) ⬆️
...ages/flutter_bloc/lib/src/multi_bloc_provider.dart 100% <ø> (ø) ⬆️
packages/flutter_bloc/lib/src/bloc_listener.dart 100% <ø> (ø) ⬆️
...lutter_bloc/lib/src/multi_repository_provider.dart 100% <ø> (ø) ⬆️
packages/flutter_bloc/lib/src/bloc_provider.dart 100% <ø> (ø) ⬆️
...ages/flutter_bloc/lib/src/multi_bloc_listener.dart 100% <ø> (ø) ⬆️

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 8b10f05...87ad22e. Read the comment docs.

@felangel felangel merged commit e173809 into master Jan 11, 2020
@felangel felangel deleted the multi-provider-type-inference branch January 11, 2020 23:49
@felangel felangel restored the multi-provider-type-inference branch January 16, 2020 23:15
@felangel felangel deleted the multi-provider-type-inference branch January 16, 2020 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pkg:flutter_bloc This issue is related to the flutter_bloc package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants