Skip to content
pubscout

bloc_presentation_test

1.2.0, released 2 years ago by leancode.co

A testing library for Blocs and Cubits utilizing BlocPresentationMixin.

WASM-ready
$ flutter pub add bloc_presentation_test
Source repository

What it does

Provides utility functions and mock classes to test presentation streams in Blocs and Cubits that use the BlocPresentationMixin. It offers approaches like whenListenPresentation and MockPresentationBloc to facilitate stream testing.

AI-written summary of version 1.2.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You are testing Blocs or Cubits that use the bloc_presentation package
  • You need to verify presentation events emitted by your state management components

Skip it when

  • You are not using the bloc_presentation package in your app
  • You are using a different state management approach like Riverpod or Provider

Strengths

  • Simplifies testing of presentation streams with mock utilities
  • Integrates well with mocktail and bloc testing workflows

Weaknesses

  • Strictly tied to the bloc_presentation package ecosystem
  • Limited usefulness outside of specific mixin-based Bloc architectures

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
6

Add the package as a dev dependency in pubspec.yaml.

final mockCubit = MockCommentCubit();
final controller = whenListenPresentation(mockCubit);
controller.add(const FailedToUpvote());

Alternatives

Packages that do the same job and could replace bloc_presentation_test.

  • bloc_test

    Standard testing library for the bloc ecosystem covering core bloc and cubit testing.

Works with

Packages commonly used together with bloc_presentation_test: ones it builds on, ones built on it, and its own family.