Skip to content

Flutter

devpul_flutter reports Flutter errors, app lifecycle changes, debugPrint output and route changes, and overrides platform settings while the app runs.

dependencies:
devpul: ^1.1.1
devpul_flutter: ^1.1.0
void main() {
DevpulFlutter.install();
runApp(const MyApp());
}

Reports FlutterErrors and uncaught platform errors with stack traces. For an error in a build or layout, Widget names the widget in your code that caused it and where it was created, as file:line:column, with widget creation tracking on (the debug default; --no-track-widget-creation turns it off). Flutter's other diagnostics show under Diagnostics, and errors Flutter marks as silent (image loading, for example) carry a silent badge. Existing FlutterError.onError and PlatformDispatcher.onError handlers keep running, so crash reporters are unaffected.

Flutter web does not call PlatformDispatcher.onError (flutter#100277). To see uncaught async errors there:

runZonedGuarded(
() => runApp(const MyApp()),
(e, s) => Devpul.error(e, s, source: 'zone'),
);

install() also registers two handlers that run only when called: flutter.screenshot, the window as a PNG, and flutter.device, the platform, OS version, build mode, Flutter and Dart versions, locale, window size, text scale, brightness and accessibility settings. The UI's bug report reads both, and agents call them through MCP.

install() also sends each app lifecycle change as a lifecycle event with state: resumed, inactive, hidden, paused or detached, as Flutter reports them, so the breadcrumbs before an error show whether the app had just come back from the background. On desktop and web the app goes inactive whenever its window or tab loses focus. Events lists them only with Lifecycle on.

DevpulFlutter.captureDebugPrint();

Every debugPrint line also goes to the Logs tab at level debug, except Flutter's console report of an error install() already sent to Errors. Console output is unchanged.

final app = MaterialApp(navigatorObservers: [DevpulNavigatorObserver()]);

Each push, pop, replace and remove becomes a route event with action, route, previous and arguments. A route without a name shows its screen widget, such as CartPage, once its first frame is built, so its event goes out after that frame. Without widget creation tracking it shows its type. The route on top when an error happens goes out with it as route. The observer also offers a Routes tab with the navigation stack at each step; allow it when DevPul asks. With go_router, pass the observer in GoRouter(observers: [...]); the go_router plugin adds the route tree and the match stack.

const app = MaterialApp(builder: DevpulApp.builder);

The builder offers an Overrides tab that sets the text scale, brightness, locale, bold text and disabled animations the app sees, as if changed on the device. Brightness picks theme or darkTheme while themeMode is ThemeMode.system; a themeMode the app sets stays. The locales are the app's supportedLocales. Overrides last until the app restarts. CupertinoApp and WidgetsApp take the same builder, and so do the .router forms. With a builder of your own, wrap its result: builder: (context, child) => DevpulApp.builder(context, yours(context, child)).

The values in effect at start and after each change go out as an overrides event, so the breadcrumbs before an error show the text scale or locale it happened under. Agents read and set them through devpul mcp.