text
stringlengths
1
474
import 'package:sentry_flutter/sentry_flutter.dart';
Future<void> main() async {
await SentryFlutter.init(
(options) => options.dsn = 'https://example@sentry.io/example',
appRunner: () => runApp(const MyApp()),
);
}<code_end>
Alternatively, you can pass the DSN to Flutter using the dart-define tag:<topic_end>
<topic_start>
What does that give me?
This is all you need for Sentry to capture unhandled errors in Dart and native layers.
This includes Swift, Objective-C, C, and C++ on iOS, and Java, Kotlin, C, and C++ on Android.<topic_end>
<topic_start>
4. Capture errors programmatically
Besides the automatic error reporting that Sentry generates by
importing and initializing the SDK,
you can use the API to report errors to Sentry:
<code_start>await Sentry.captureException(exception, stackTrace: stackTrace);<code_end>
For more information, see the Sentry API docs on pub.dev.<topic_end>
<topic_start>
Learn more
Extensive documentation about using the Sentry SDK can be found on Sentry’s site.<topic_end>
<topic_start>
Complete example
To view a working example,
see the Sentry flutter example app.
<topic_end>
<topic_start>Performance
Flutter performance basicsinfo Note
If your app has a performance issue and you are
trying to debug it, check out the DevTool’s page
on Using the Performance view.What is performance? Why is performance important? How do I improve performance?Our goal is to answer those three questions (mainly the third one), and
anything related to them. This document should serve as the single entry
point or the root node of a tree of resources that addresses any questions
that you have about performance.The answers to the first two questions are mostly philosophical,
and not as helpful to many developers who visit this page with specific
performance issues that need to be solved.
Therefore, the answers to those
questions are in the appendix.To improve performance, you first need metrics: some measurable numbers to
verify the problems and improvements.
In the metrics page,
you’ll see which metrics are currently used,
and which tools and APIs are available to get the metrics.There is a list of Frequently asked questions,
so you can find out if the questions you have or the problems you’re having
were already answered or encountered, and whether there are existing solutions.
(Alternatively, you can check the Flutter GitHub issue database using the
performance label.)Finally, the performance issues are divided into four categories. They
correspond to the four labels that are used in the Flutter GitHub issue
database: “perf: speed”, “perf: memory”,
“perf: app size”, “perf: energy”.The rest of the content is organized using those four categories.<topic_end>
<topic_start>
Speed
Are your animations janky (not smooth)? Learn how to
evaluate and fix rendering issues.Improving rendering performance<topic_end>
<topic_start>
App size
How to measure your app’s size. The smaller the size,
the quicker it is to download.Measuring your app’s size
<topic_end>
<topic_start>Impeller rendering engine
<topic_end>
<topic_start>
What is Impeller?
Impeller provides a new rendering runtime for Flutter.
The Flutter team’s believes this solves Flutter’s
early-onset jank issue.
Impeller precompiles a smaller, simpler set of shaders
at Engine build time so they don’t compile at runtime.For a video introduction to Impeller, check out the following
talk from Google I/O 2023.Introducing Impeller - Flutter’s new rendering engineImpeller has the following objectives:<topic_end>
<topic_start>
Availability
Where can you use Impeller?<topic_end>
<topic_start>
iOS
Flutter enables Impeller by default on iOS.To disable Impeller on iOS when debugging,
pass --no-enable-impeller to the flutter run command.To disable Impeller on iOS when deploying your app,
add the following tags under the top-level <dict> tag in your
app’s Info.plist file.The team continues to improve iOS support.
If you encounter performance or fidelity issues
with Impeller on iOS, file an issue in the GitHub tracker.
Prefix the issue title with [Impeller] and
include a small reproducible test case.<topic_end>
<topic_start>
macOS
Impeller is available for macOS in preview as of
the Flutter 3.13 stable release.
It continues to be in preview as of the 3.19 release.To enable Impeller on macOS when debugging,
pass --enable-impeller to the flutter run command.To enable Impeller on macOS when deploying your app,
add the following tags under the top-level <dict> tag in your
app’s Info.plist file.<topic_end>
<topic_start>
Android
As of Flutter 3.16, Impeller is available behind
a flag on Android devices that support Vulkan.
It continues to be in preview as of the 3.19 release.Does your device support Vulkan?
You can determine whether your Android device
supports Vulkan at checking for Vulkan support.You can try Impeller on Vulkan-capable Android devices
by passing --enable-impeller to flutter run:Or, you can add the following setting to your project’s
AndroidManifest.xml file under the <application> tag:<topic_end>
<topic_start>