Skip to content
CARP Docs
Ask AISystemLightDark
On this page

Installation

Add carp_debug_flutter as a dev dependency and configure iOS and Android.

Copy MarkdownOpen inOpen in GitHubView as MarkdownOpen in Scira AIOpen in ChatGPTOpen in ClaudeOpen in Cursor
  1. Add the dependency

    Add the package under dev_dependencies so it is excluded from production archives (see Production builds).

    pub.devGitLocal path
    # pubspec.yaml
    dev_dependencies:
      carp_debug_flutter: ^0.1.0
    # pubspec.yaml
    dev_dependencies:
      carp_debug_flutter:
        git:
          url: https://github.com/carp-dk/carp_debug_flutter

    Use a path dependency for local development:

    # pubspec.yaml
    dev_dependencies:
      carp_debug_flutter:
        path: ../carp_debug_flutter

    The built-in Shared Preferences and Database tools depend on shared_preferences and sembast. If your app already uses them, as every CARP app does, no extra setup is needed.

    Then fetch the dependencies:

    flutter pub get

    Note

    Follow Production builds so release builds compile and ship nothing from the toolkit package. If you add it under dependencies instead and only set enabled: false at runtime, the package is still in the archive and users might find a way to access it.

  2. Configure the platforms

    AndroidiOS

    minSdk 24 and compileSdk 34 or higher are required.

    The minimum deployment target is iOS 15.0. The plugin supports both Swift Package Manager and CocoaPods; Swift Package Manager is recommended.

    Note

    If you switch a project from CocoaPods to Swift Package Manager, run pod deintegrate first and make sure platform :ios in ios/Podfile is at least 15.0.

  3. Wrap your app

    Continue to the Quickstart to wrap your app's root widget in CarpDebugToolkit.

Keeping it out of production

Exclude the toolkit from the release archive. With the package declared as a dev_dependency, reference it only from kDebugMode-gated code, so it is both disabled at runtime and excluded from the release archive:

import 'package:flutter/foundation.dart';

// Folds to `runApp(app)` in release; the wrapper (and the package) is
// tree-shaken away.
runApp(kDebugMode ? debug.wrapWithDebugToolkit(app) : app);

The full pattern (app-local hook, debug-only setup file and per-platform exclusion details) is on the Production builds page.

Runtime switch

CarpDebugToolkit also accepts an enabled flag (default true) for cases where the package stays in the build but you want a runtime switch. When enabled is false, CarpDebugToolkit returns its child untouched, with zero overhead.

Quick links

Page · DocumentationCARP DocumentationPage · DocumentationIntroductionPage · DocumentationQuickstartPage · DocumentationTerminologyPage · DocumentationArchitecture