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

# Manual Setup | Sentry 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.

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

Error Monitoring\[ ]Tracing\[ ]Profiling\[ ]Logs

Sentry captures data by using an SDK within your application's runtime. These are platform-specific and allow Sentry to have a deep understanding of how your application works.

`pubspec.yaml`

```yml
dependencies:
  sentry_flutter: ^9.18.0
```

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

Configuration should happen as early as possible in your application's lifecycle.

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

Future<void> main() async {
  await SentryFlutter.init(
    (options) {
      options.dsn = '___PUBLIC_DSN___';
      // 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___ profiling
      // The sampling rate for profiling is relative to tracesSampleRate
      // Setting to 1.0 will profile 100% of sampled transactions:
      // Note: Profiling alpha is available for iOS and macOS since SDK version 7.12.0
      options.profilesSampleRate = 1.0;
      // ___PRODUCT_OPTION_END___ profiling
      // ___PRODUCT_OPTION_START___ logs
      // Enable logs to be sent to Sentry
      options.enableLogs = true;
      // ___PRODUCT_OPTION_END___ logs
    },
    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](https://docs.sentry.io/platforms/dart/guides/flutter/manual-setup.md#verify)

Verify that your app is sending events to Sentry by adding the following snippet, which includes an intentional error. You should see the error reported in Sentry within a few minutes.

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

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

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

* [Learn about the features of Sentry's Flutter SDK](https://docs.sentry.io/platforms/dart/guides/flutter/features.md)
* [Add readable stack traces to errors](https://docs.sentry.io/platforms/dart/guides/flutter/upload-debug.md#when-to-upload/)
* [Add performance instrumentation to your app](https://docs.sentry.io/platforms/dart/guides/flutter/tracing/instrumentation.md)
