radarscope 0.1.3
radarscope: ^0.1.3 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.
radarscope #
Umbrella package for the Radar observability suite. One import, one
Radar.init call, one unified overlay badge and dashboard — composes
flutter_leak_radar and
flutter_perf_radar without
duplicating any domain logic.
Installation #
dependencies:
radarscope: ^0.1.0
This single dependency pulls in flutter_leak_radar, flutter_perf_radar,
and radar_trace.
Quick start #
import 'package:radarscope/radarscope.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Radar.init(RadarConfig.standard());
runApp(
Radar.overlay(child: const MyApp()),
);
}
That's it. Both the memory leak detector and the performance/stability tracer are active in debug/profile builds and are complete no-ops in release.
Wire the navigator observer #
MaterialApp(
navigatorObservers: [Radar.navigatorObserver],
home: ...,
)
Usage #
Tracing operations #
// Synchronous.
final result = Radar.trace('parse_config', () => parseConfig(raw));
// Async.
final user = await Radar.traceAsync('fetch_user', () => api.getUser(id));
// Manual start/stop.
final handle = Radar.start('image_decode');
decoder.decode(bytes, onDone: () => handle.stop());
Tracking object lifetimes (leak detection) #
class MyController {
MyController() {
Radar.track(this, tag: 'MyController');
}
void dispose() {
Radar.markDisposed(this);
// ... release resources
}
}
Opening the unified inspector #
Navigator.of(context).push(
MaterialPageRoute(builder: (_) => const RadarScreen()),
);
RadarScreen shows three tabs — Leaks (powered by LeakRadarView),
Performance (PerfRadarView, frame/jank timing), and Stability
(StabilityView, error and main-thread-stall capture) — in a single
dark-theme scaffold. Performance and Stability are both driven by the
flutter_perf_radar runtime, so the three domains ride on just two engines.
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,
stallThresholdMicros: 100000,
),
));
Features #
- One-import story —
import 'package:radarscope/radarscope.dart're-exports all public symbols fromflutter_leak_radar,flutter_perf_radar, and theradar_tracetypes needed byRadar.start()consumers. - Single
Radar.initcall — initialises both engines in parallel viaFuture.wait. - Unified overlay —
Radar.overlay(child: ...)renders one draggable badge combining leak, performance, and stability signals. Badge colour reflects the worst signal: green (clean), amber (warning leaks, jank, or stalls), red (critical leaks or errors). RadarScreen— three-tab (Leaks, Performance, Stability) unified dashboard. No extra wiring needed.RadarConfig.standard()— opinionated defaults for both domains; override either independently via named arguments.- Zero-throw contract —
Radardelegates to each domain facade and never throws into the host app. - Complete no-op in release — all calls are safe to leave in production code. No build flavours or conditional guards required.
Related packages #
| Package | Purpose |
|---|---|
flutter_leak_radar |
On-device memory leak detector — heap growth, precise retention, overlay. |
flutter_perf_radar |
Performance and stability tracer — frame timing, jank, rebuild counting, plus error capture and main-thread stall detection. |
radar_trace |
Pure-Dart tracer engine — spans, histograms, Zone nesting. |
flutter_leak_radar_lint |
Static analysis: undisposed controllers, uncancelled subscriptions. |
License #
MIT — see LICENSE.