radarscope 0.1.0 copy "radarscope: ^0.1.0" to clipboard
radarscope: ^0.1.0 copied to clipboard

All-in-one umbrella for the Radar observability suite — one import and one init for Flutter memory, performance, and stability, with an overlay badge and a unified inspector.

example/README.md

radarscope example #

Minimal wiring for the radarscope umbrella package — one import, one init call, unified overlay and inspector for both leak and perf domains.

Setup in main() #

import 'package:flutter/material.dart';
import 'package:radarscope/radarscope.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Radar.init(RadarConfig.standard());
  runApp(
    Radar.overlay(child: const MyApp()),
  );
}

RadarConfig.standard() enables both the memory leak detector and the performance tracer in debug/profile builds. The overlay badge reflects the worst signal across both: green (clean), amber (jank or errors), red (critical leaks). Tap the badge to open RadarScreen.

Wire the navigator observer #

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      navigatorObservers: [Radar.navigatorObserver],
      home: const HomeScreen(),
    );
  }
}

Track object lifetimes #

class FeatureController {
  FeatureController() {
    Radar.track(this, tag: 'FeatureController');
  }

  void dispose() {
    Radar.markDisposed(this);
  }
}

Instrument operations #

// Sync span.
final result = Radar.trace('parse_config', () => parseConfig(raw));

// Async span.
final data = await Radar.traceAsync('load_feed', () => api.getFeed());

// Manual start/stop.
final handle = Radar.start('encode_image');
encoder.run(bytes, onFinished: () => handle.stop());

Open the unified inspector #

Navigator.of(context).push(
  MaterialPageRoute(builder: (_) => const RadarScreen()),
);

RadarScreen shows a Leaks tab and a Performance tab.

Custom configuration #

await Radar.init(RadarConfig(
  leak: LeakRadarConfig.standard(
    autoScan: AutoScan(onNavigation: true, period: Duration(minutes: 2)),
    showOverlay: true,
  ),
  perf: PerfRadarConfig(
    enabled: kDebugMode || kProfileMode,
    showOverlay: true,
    jankThresholdMicros: 8333,     // 120 fps threshold
    stallThresholdMicros: 100000,
  ),
));
0
likes
0
points
236
downloads

Publisher

verified publishertp9imka.dev

Weekly Downloads

All-in-one umbrella for the Radar observability suite — one import and one init for Flutter memory, performance, and stability, with an overlay badge and a unified inspector.

Homepage
Repository (GitHub)
View/report issues

Topics

#memory #performance #observability #debugging #flutter

License

unknown (license)

Dependencies

flutter, flutter_leak_radar, flutter_perf_radar, radar_trace, radar_ui, share_plus

More

Packages that depend on radarscope