otel_flutter_bloc 0.1.0-beta.1 copy "otel_flutter_bloc: ^0.1.0-beta.1" to clipboard
otel_flutter_bloc: ^0.1.0-beta.1 copied to clipboard

Flutter overlay for `otel_bloc`. Re-exports the core observer + semantics and pulls in `flutter_bloc` so Flutter apps add one dependency to get OTel coverage of every Bloc / Cubit.

otel_flutter_bloc #

Flutter overlay for otel_bloc.

Re-exports the core OTelBlocObserver + BlocSemantics and pulls in flutter_bloc so Flutter apps add one dependency instead of managing bloc + flutter_bloc + otel_bloc separately.

import 'package:otel_flutter_bloc/otel_flutter_bloc.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await DOTel.initialize(serviceName: 'my-app');
  Bloc.observer = OTelBlocObserver();
  runApp(const MyApp());
}

Choosing this vs. otel_bloc #

  • Flutter app using flutter_bloc → use this package. One dependency for the observer + flutter_bloc.
  • Pure-Dart bloc app (a server, CLI, isolate) → use otel_bloc directly. No Flutter dependency.

The runtime behavior is identical — the observer is the same class in both cases. Bloc.observer is a global, so a single Bloc.observer = OTelBlocObserver() at app startup is the entire install.

What this package adds beyond re-exports #

Nothing today, by design. The bloc observer install pattern is global (Bloc.observer = ...), not widget-scoped, so there's no useful OTelBlocApp / OTelBlocProvider wrapper to add. If something widget-flavored becomes worth shipping (e.g., automatic context propagation through BlocProvider-tree boundaries), it lands here.

License #

Apache 2.0 — see LICENSE.

0
likes
150
points
12
downloads

Documentation

API reference

Publisher

verified publisherdartastic.io

Weekly Downloads

Flutter overlay for `otel_bloc`. Re-exports the core observer + semantics and pulls in `flutter_bloc` so Flutter apps add one dependency to get OTel coverage of every Bloc / Cubit.

Homepage
Repository (GitHub)
View/report issues

License

Apache-2.0 (license)

Dependencies

dartastic_opentelemetry, dartastic_opentelemetry_api, flutter, flutter_bloc, otel_bloc

More

Packages that depend on otel_flutter_bloc