text
stringlengths 1
474
|
|---|
<topic_end>
|
<topic_start>
|
Launch options
|
The examples demonstrate running Flutter using the default launch settings.In order to customize your Flutter runtime,
|
you can also specify the Dart entrypoint, library, and route.<topic_end>
|
<topic_start>
|
Dart entrypoint
|
Calling run on a FlutterEngine, by default,
|
runs the main() Dart function
|
of your lib/main.dart file.You can also run a different entrypoint function by using
|
runWithEntrypoint with an NSString specifying
|
a different Dart function.info Note
|
Dart entrypoint functions other than main()
|
must be annotated with the following in order to
|
not be tree-shaken away when compiling:<topic_end>
|
<topic_start>
|
Dart library
|
In addition to specifying a Dart function, you can specify an entrypoint
|
function in a specific file.For instance the following runs myOtherEntrypoint()
|
in lib/other_file.dart instead of main() in lib/main.dart:<topic_end>
|
<topic_start>
|
Route
|
Starting in Flutter version 1.22, an initial route can be set for your Flutter
|
WidgetsApp when constructing the FlutterEngine or the
|
FlutterViewController.This code sets your dart:ui’s window.defaultRouteName
|
to "/onboarding" instead of "/".Alternatively, to construct a FlutterViewController directly without pre-warming
|
a FlutterEngine:lightbulb Tip
|
In order to imperatively change your current Flutter
|
route from the platform side after the FlutterEngine
|
is already running, use pushRoute()
|
or popRoute() on the FlutterViewController.To pop the iOS route from the Flutter side,
|
call SystemNavigator.pop().See Navigation and routing for more about Flutter’s routes.<topic_end>
|
<topic_start>
|
Other
|
The previous example only illustrates a few ways to customize
|
how a Flutter instance is initiated. Using platform channels,
|
you’re free to push data or prepare your Flutter environment
|
in any way you’d like, before presenting the Flutter UI using a
|
FlutterViewController.
|
<topic_end>
|
<topic_start>Debug your add-to-app module
|
Once you’ve integrated the Flutter module to your project and used Flutter’s
|
platform APIs to run the Flutter engine and/or UI,
|
you can then build and run your Android or iOS app the same way
|
you run normal Android or iOS apps.However, Flutter is now powering the UI in places where you’re showing a
|
FlutterActivity or FlutterViewController.<topic_end>
|
<topic_start>
|
Debugging
|
You might be used to having your suite of favorite Flutter debugging tools
|
available to you automatically when running flutter run or an equivalent
|
command from an IDE. But you can also use all your Flutter
|
debugging functionalities such as hot reload, performance
|
overlays, DevTools, and setting breakpoints in add-to-app scenarios.These functionalities are provided by the flutter attach mechanism.
|
flutter attach can be initiated through different pathways,
|
such as through the SDK’s CLI tools,
|
through VS Code or IntelliJ/Android Studio.flutter attach can connect as soon as you run your FlutterEngine, and
|
remains attached until your FlutterEngine is disposed. But you can invoke
|
flutter attach before starting your engine. flutter attach waits for
|
the next available Dart VM that is hosted by your engine.<topic_end>
|
<topic_start>Terminal
|
Run flutter attach or flutter attach -d deviceId to attach from the terminal.<topic_end>
|
<topic_start>VS Code
|
<topic_end>
|
<topic_start>Build the iOS version of the Flutter app in the Terminal
|
To generate the needed iOS platform dependencies,
|
run the flutter build command.<topic_end>
|
<topic_start>Start debugging with VS Code first
|
If you use VS Code to debug most of your code, start with this section.<topic_end>
|
<topic_start>Start the Dart debugger in VS Code
|
To open the Flutter app directory, go to
|
File >
|
Open Folder… and choose the my_app directory.Open the lib/main.dart file.If you can build an app for more than one device,
|
you must select the device first.Go to
|
View >
|
Command Palette…You can also press Ctrl / Cmd +
|
Shift + P.Type flutter select.Click the Flutter: Select Device command.Choose your target device.Click the debug icon
|
().
|
This opens the Debug pane and launches the app.
|
Wait for the app to launch on the device and for the debug pane to
|
indicate Connected.
|
The debugger takes longer to launch the first time.
|
Subsequent launches start faster.This Flutter app contains two buttons:<topic_end>
|
<topic_start>Attach to the Flutter process in Xcode
|
To attach to the Flutter app, go to
|
Debug >
|
Attach to Process >
|
Runner.Runner should be at the top of the Attach to Process menu
|
under the Likely Targets heading.<topic_end>
|
<topic_start>Start debugging with Xcode first
|
If you use Xcode to debug most of your code, start with this section.<topic_end>
|
<topic_start>Start the Xcode debugger
|
Open ios/Runner.xcworkspace from your Flutter app directory.Select the correct device using the Scheme menu in the toolbar.If you have no preference, choose iPhone Pro 14.Run this Runner as a normal app in Xcode.When the run completes, the Debug area at the bottom of Xcode displays
|
a message with the Dart VM service URI. It resembles the following response:Copy the Dart VM service URI.<topic_end>
|
<topic_start>Attach to the Dart VM in VS Code
|
To open the command palette, go to
|
View >
|
Command Palette…You can also press Cmd + Shift + P.Type debug.Click the Debug: Attach to Flutter on Device command.In the Paste an VM Service URI box, paste the URI you copied
|
from Xcode and press Enter.You can also create a .vscode/launch.json file in your Flutter module project.
|
This enables you to attach using the Run > Start Debugging command or F5:<topic_end>
|
<topic_start>IntelliJ / Android Studio
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.