builder static method

TransitionBuilder builder({
  1. bool showOnShake = true,
  2. ShakeDetectorCreator createShakeDetector = _defaultCreateShakeDetector,
  3. bool enableOnlyInDebugMode = true,
})

In debug mode, this returns a builder to add a DebugOverlay to your app.

In profile and release builds, the returned builder doesn't add any widgets unless enableOnlyInDebugMode is set to false.

This is usually used as the WidgetsApp.builder/MaterialApp.builder/ CupertinoApp.builder:

MaterialApp(
  title: 'My Fancy App',
  builder: DebugOverlay.builder(),
  home: MyHomePage(),
)

You can open the overlay by shaking your phone (if showOnShake is true) or by calling show or hide.

Implementation

static TransitionBuilder builder({
  bool showOnShake = true,
  ShakeDetectorCreator createShakeDetector = _defaultCreateShakeDetector,
  bool enableOnlyInDebugMode = true,
}) {
  return _isInDebugMode || !enableOnlyInDebugMode
      ? (context, child) => DebugOverlay(
            showOnShake: showOnShake,
            createShakeDetector: createShakeDetector,
            enableOnlyInDebugMode: enableOnlyInDebugMode,
            child: child,
          )
      : (context, child) => child ?? const SizedBox();
}