ispectify_bloc 5.2.0-dev.8 copy "ispectify_bloc: ^5.2.0-dev.8" to clipboard
ispectify_bloc: ^5.2.0-dev.8 copied to clipboard

BLoC and Cubit observer for ISpect with event, transition, change, error, completion, and redacted metadata logging.

ispectify_bloc plugs the bloc and flutter_bloc ecosystem into the ISpect toolkit. One BlocObserver forwards every event, state change, transition, and error through the log pipeline, so the whole state-management timeline shows up in the log viewer.

  • Events, transitions, errors, and create/close lifecycle hooks.
  • Per-type filtering. Mute specific Bloc or Cubit classes without touching their code.
  • Zero configuration. Set Bloc.observer and the rest is done.

Install #

dependencies:
  flutter_bloc: ^8.0.0
  ispectify: ^5.2.0-dev.8
  ispectify_bloc: ^5.2.0-dev.8

Quick start #

import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:ispect/ispect.dart';
import 'package:ispectify_bloc/ispectify_bloc.dart';

ISpect.run(
  () => runApp(const MyApp()),
  onInit: () {
    Bloc.observer = ISpectBlocObserver(logger: ISpect.logger);
  },
);

The observer emits logs under the bloc-event, bloc-transition, bloc-state, bloc-create, bloc-close, bloc-done, and bloc-error log-type keys, each with a dedicated icon, palette entry, and localized description in the log viewer. Filter them in the debug panel or through ISpectSettingsState.disabledLogTypes.

Settings #

ISpectBlocSettings controls which lifecycle events are captured and whether raw event/state payloads are written to trace meta. Payload capture is off by default — runtime types are emitted instead, so it is safe to leave the observer enabled in shared environments.

const settings = ISpectBlocSettings(
  printEvents: true,
  printTransitions: true,
  printChanges: true,
  printCreations: true,
  printClosings: true,
  printCompletions: true,
  printErrors: true,
  printEventFullData: false, // raw event payloads off by default
  printStateFullData: false, // raw state payloads off by default
  enableRedaction: true,     // route meta values through RedactionService when set
);

Presets #

// Logs disabled entirely.
ISpectBlocObserver(settings: ISpectBlocSettings.silent);

// Skip per-change / per-completion noise — keeps creations, transitions, errors.
ISpectBlocObserver(settings: ISpectBlocSettings.minimal);

// Full state payloads on transitions and changes.
ISpectBlocObserver(settings: ISpectBlocSettings.verbose);

Filtering noisy blocs #

ISpectBlocObserver(
  // Drop everything for blocs whose runtime type matches one of these patterns.
  filters: [RegExp(r'AnalyticsBloc'), 'MetricsCubit'],
  settings: ISpectBlocSettings(
    // Or skip individual events / transitions / changes by inspecting them.
    eventFilter: (bloc, event) => event is! HeartbeatEvent,
  ),
);

The ISpect toolkit #

ISpect is a modular monorepo. Pick the packages your project needs. Each one works on its own.

Package What it does
ispect Flutter UI: debug panel, log viewer, navigation observer, inspector integration.
ispect_layout Visual layout inspector with sizes, constraints, decorations, compare mode, and a color picker.
ispectify Pure-Dart logging core: typed log entries, filtering, tracing, observers.
ispectify_dio Dio HTTP interceptor with automatic redaction.
ispectify_http http package interceptor with automatic redaction.
ispectify_ws WebSocket traffic capture with automatic redaction.
ispectify_db Database operation tracing for SQL, ORMs, and KV stores.
ispectify_bloc BLoC event, state, transition, and error observer.
ispectify_riverpod Riverpod provider add, update, dispose, and failure observer.

Contributing #

Contributions are welcome. See CONTRIBUTING.md for guidelines, and open issues or pull requests at the ISpect repository.

License #

MIT. See LICENSE.


0
likes
0
points
4.56k
downloads

Publisher

verified publishershodev.live

Weekly Downloads

BLoC and Cubit observer for ISpect with event, transition, change, error, completion, and redacted metadata logging.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

bloc, ispectify, meta

More

Packages that depend on ispectify_bloc