---
title: "Manual Setup"
description: "Learn how to set up the Sentry Flutter SDK manually."
url: https://docs.sentry.io/platforms/dart/guides/flutter/manual-setup/
---

# Manual Setup for Flutter

If you can't (or prefer not to) run the [automatic setup](https://docs.sentry.io/platforms/dart/guides/flutter.md#install), you can follow the instructions below to configure your application manually.

## [Prerequisites](https://docs.sentry.io/platforms/dart/guides/flutter/manual-setup.md#prerequisites)

These instructions use Sentry Flutter SDK v10. You need:

* A Sentry [account](https://sentry.io/signup/) and [project](https://docs.sentry.io/product/projects.md)
* A Flutter application using **Flutter 3.44.0** and **Dart 3.12.0** or later
* **Android API 26** or later for Android apps. Set your app's `minSdk` to `26` or higher.
* **iOS 15.0** or **macOS 12.0** or later for Apple apps, with Swift Package Manager enabled

For an existing Sentry integration, review the [migration guide](https://docs.sentry.io/platforms/dart/guides/flutter/migration.md) before upgrading to v10.

## [Install](https://docs.sentry.io/platforms/dart/guides/flutter/manual-setup.md#install)

Add the Sentry Flutter SDK to your `pubspec.yaml`:

```yml
dependencies:
  sentry_flutter: ^10.2.0
```

### [Apple Platform Setup](https://docs.sentry.io/platforms/dart/guides/flutter/manual-setup.md#apple-platform-setup)

The Flutter plugin installs the native Sentry SDK through Swift Package Manager. CocoaPods is not supported for this plugin.

Flutter 3.44 enables Swift Package Manager by default and migrates the Xcode project when you run your app. If you previously disabled it, remove any project-level `enable-swift-package-manager: false` setting and run:

```bash
flutter config --enable-swift-package-manager
flutter pub get
```

Set your Xcode deployment targets to iOS 15.0 or macOS 12.0 or later. For custom targets, flavors, or manual migration, follow [Flutter's Swift Package Manager guide](https://docs.flutter.dev/packages-and-plugins/swift-package-manager/for-app-developers/).

Keep CocoaPods if other plugins still require it. Flutter can use both dependency managers in the same application.

## [Configure](https://docs.sentry.io/platforms/dart/guides/flutter/manual-setup.md#configure)

Choose the features you want to configure, and this guide will show you how:

Error Monitoring\[ ]Tracing\[ ]Session Replay

Want to learn more about these features?

* [**Issues**](https://docs.sentry.io/product/issues.md) (always enabled): Sentry's core error monitoring product that automatically reports errors, uncaught exceptions, and unhandled rejections. If you have something that looks like an exception, Sentry can capture it.
* [**Tracing**](https://docs.sentry.io/product/tracing.md): Track software performance while seeing the impact of errors across multiple systems. For example, distributed tracing allows you to follow a request from the frontend to the backend and back.
* [**Session Replay**](https://docs.sentry.io/product/session-replay/web.md): Get to the root cause of an issue faster by viewing a video-like reproduction of what was happening in the user's browser before, during, and after the problem.
* [**Logs**](https://docs.sentry.io/product/logs.md): Centralize and analyze your application logs to correlate them with errors and performance issues. Search, filter, and visualize log data to understand what's happening in your applications.
* [**Application Metrics**](https://docs.sentry.io/product/metrics.md) (always enabled): Track and analyze custom application metrics, such as response times and database query durations, to understand trends and patterns in your application's performance and behavior over time.

### [Initialize the Sentry SDK](https://docs.sentry.io/platforms/dart/guides/flutter/manual-setup.md#initialize-the-sentry-sdk)

Configuration should happen as **early as possible** in your application's lifecycle. Logs and metrics are enabled by default; use `Sentry.logger` and `Sentry.metrics` after initialization without an enable flag.

Import and initialize the SDK in your app's `main` function:

```dart
import 'package:flutter/widgets.dart';
import 'package:sentry_flutter/sentry_flutter.dart';

Future<void> main() async {
  await SentryFlutter.init(
    (options) {
      options.dsn = 'https://<key>@o<orgId>.ingest.sentry.io/<projectId>';
      // Adds request headers and IP for users, for more info visit:
      // https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/
      options.sendDefaultPii = true;
      // ___PRODUCT_OPTION_START___ performance
      // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
      // We recommend adjusting this value in production.
      options.tracesSampleRate = 1.0;
      // ___PRODUCT_OPTION_END___ performance
      // ___PRODUCT_OPTION_START___ session-replay
      // Record session replays for 100% of errors and 10% of sessions
      options.replay.onErrorSampleRate = 1.0;
      options.replay.sessionSampleRate = 0.1;
      // ___PRODUCT_OPTION_END___ session-replay
    },
    appRunner: () => runApp(
      SentryWidget(
        child: MyApp(),
      ),
    ),
  );

  // you can also configure SENTRY_DSN, SENTRY_RELEASE, SENTRY_DIST, and
  // SENTRY_ENVIRONMENT via Dart environment variable (--dart-define)
}
```

## [Verify Your Setup](https://docs.sentry.io/platforms/dart/guides/flutter/manual-setup.md#verify-your-setup)

Let's test your setup and confirm that data reaches your Sentry project.

### [Issues](https://docs.sentry.io/platforms/dart/guides/flutter/manual-setup.md#issues)

To verify that Sentry captures errors and creates issues in your Sentry project, add this intentional error to your application:

```dart
import 'package:sentry_flutter/sentry_flutter.dart';

try {
  throw StateError('Sentry Test Exception');
} catch (exception, stackTrace) {
  await Sentry.captureException(
    exception,
    stackTrace: stackTrace,
  );
}
```

### [Tracing](https://docs.sentry.io/platforms/dart/guides/flutter/manual-setup.md#tracing)

To test your tracing configuration, create a custom transaction and span:

```dart
final transaction = Sentry.startTransaction('test-transaction', 'task');
final span = transaction.startChild('test-span');
await span.finish();
await transaction.finish();
```

### [Logs](https://docs.sentry.io/platforms/dart/guides/flutter/manual-setup.md#logs)

Logs are enabled by default. Use the Sentry logger to send structured logs from anywhere in your application:

```dart
Sentry.logger.info('User clicked checkout button');

Sentry.logger.info('Order completed', attributes: {
  'order_id': SentryAttribute.string('12345'),
  'total': SentryAttribute.double(99.99),
});

Sentry.logger.warn('Warning message');
Sentry.logger.error('Error occurred');
```

### [Metrics NEW](https://docs.sentry.io/platforms/dart/guides/flutter/manual-setup.md#metrics-)

Metrics are enabled by default. Send test metrics from your app to verify that metrics are arriving in Sentry:

```dart
Sentry.metrics.count('checkout.failed', 1);
Sentry.metrics.gauge('queue.depth', 42);
Sentry.metrics.distribution('cart.amount_usd', 187.5);
```

### [View Captured Data in Sentry](https://docs.sentry.io/platforms/dart/guides/flutter/manual-setup.md#view-captured-data-in-sentry)

Now, head over to your project on [Sentry.io](https://sentry.io) to view the collected data (it takes a couple of moments for the data to appear).

Need help locating captured data in your Sentry project?

* Open the [**Issues**](https://sentry.io/orgredirect/organizations/:orgslug/issues/) page and select an error from the issues list to view the full details and context of this error. For more details, see the [Issue Details documentation](https://docs.sentry.io/product/issues/issue-details.md).
* Open the [**Traces**](https://sentry.io/orgredirect/organizations/:orgslug/explore/traces/) page and select a trace to reveal more information about each span, its duration, and any errors. For an interactive UI walkthrough, click [here](https://docs.sentry.io/product/sentry-basics/getting-started-tutorial/generate-first-error.md#ui-walkthrough).
* Open the [**Replays**](https://sentry.io/orgredirect/organizations/:orgslug/replays/) page and select an entry from the list to get a detailed view where you can replay the interaction and get more information to help you troubleshoot.
* Open the [**Logs**](https://sentry.io/orgredirect/organizations/:orgslug/explore/logs/) page and filter by service, environment, or search keywords to view log entries from your application. For an interactive UI walkthrough, click [here](https://docs.sentry.io/product/logs.md#overview).
* Open the [**Application Metrics**](https://sentry.io/orgredirect/organizations/:orgslug/explore/metrics) page to view and analyze your metrics. For more details, see this [interactive walkthrough](https://docs.sentry.io/product/metrics.md#overview).

## [Next Steps](https://docs.sentry.io/platforms/dart/guides/flutter/manual-setup.md#next-steps)

At this point, you should have integrated Sentry into your Flutter application and should already be sending data to your Sentry project.

Now's a good time to customize your setup and look into more advanced topics. Our next recommended steps for you are:

* Explore [practical guides](https://docs.sentry.io/get-started/guides.md) on what to monitor, log, track, and investigate after setup
* Continue to [customize your configuration](https://docs.sentry.io/platforms/dart/guides/flutter/configuration.md)
* Add readable [stack traces](https://docs.sentry.io/platforms/dart/guides/flutter/upload-debug.md#when-to-upload/) to errors
* Learn about the [features of Sentry's Flutter SDK](https://docs.sentry.io/platforms/dart/guides/flutter/features.md)
* Add [performance instrumentation to your app](https://docs.sentry.io/platforms/dart/guides/flutter/tracing/instrumentation.md)

Are you having problems setting up the SDK?

* Find various topics in [Troubleshooting](https://docs.sentry.io/platforms/dart/guides/flutter/troubleshooting.md)
* [Get support](https://www.sentry.help/en/)
