text
stringlengths 1
474
|
|---|
dependencies {
|
…
|
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
|
…
|
}
|
…<code_end>
|
The two com.crashlytics.sdk.android:crashlytics dependencies
|
might not be the same version. In this example,
|
the host app requested v2.10.1 and the Flutter
|
module plugin requested v2.9.9.By default, Gradle v5
|
resolves dependency version conflicts
|
by using the newest version of the library.This is generally ok as long as there are no API
|
or implementation breaking changes between the versions.
|
For example, you might use the new Crashlytics library
|
in your existing app as follows:
|
<code_start>…
|
dependencies {
|
…
|
implementation 'com.google.firebase:firebase-crashlytics:17.0.0-beta03
|
…
|
}
|
…<code_end>
|
This approach won’t work since there are major API differences
|
between the Crashlytics’ Gradle library version
|
v17.0.0-beta03 and v2.9.9.For Gradle libraries that follow semantic versioning,
|
you can generally avoid compilation and runtime errors
|
by using the same major semantic version in your
|
existing app and Flutter module plugin.
|
<topic_end>
|
<topic_start>Add Flutter to iOS
|
<topic_end>
|
<topic_start>
|
Topics
|
<topic_end>
|
<topic_start>Integrate a Flutter module into your iOS project
|
Flutter UI components can be incrementally added into your existing iOS
|
application as embedded frameworks. There are a few ways to embed Flutter
|
in your existing application.Use the CocoaPods dependency manager and installed Flutter SDK.
|
In this case, the flutter_module is compiled from
|
the source each time the app is built. (Recommended.)Create frameworks for the Flutter engine, your compiled Dart code,
|
and all Flutter plugins. Here, you manually embed the frameworks,
|
and update your existing application’s build settings in Xcode.
|
This can be useful for teams that don’t want to require every developer
|
to have the Flutter SDK and Cocoapods installed locally.Create frameworks for your compiled Dart code,
|
and all Flutter plugins. Use CocoaPods for the Flutter engine.
|
With this option, embed the frameworks for your application
|
and the plugins in Xcode, but distribute the
|
Flutter engine as a CocoaPods podspec.
|
This is similar to the second option, but it provides
|
an alternative to distributing the large Flutter.xcframework.For examples using an app built with UIKit,
|
see the iOS directories in the add_to_app code samples.
|
For an example using SwiftUI, see the iOS directory in News Feed App.<topic_end>
|
<topic_start>
|
System requirements
|
Your development environment must meet the
|
macOS system requirements for Flutter
|
with Xcode installed.
|
Flutter supports iOS 12 and later.
|
Additionally, you will need CocoaPods
|
version 1.10 or later.<topic_end>
|
<topic_start>
|
Create a Flutter module
|
To embed Flutter into your existing application,
|
using any of the methods mentioned above,
|
first create a Flutter module.From the command line, run:A Flutter module project is created at some/path/my_flutter/.
|
If you are using the first method mentioned above,
|
the module should be created in the same parent directory
|
as your existing iOS app.From the Flutter module directory, you can run the same flutter
|
commands you would in any other Flutter project,
|
like flutter run --debug or flutter build ios.
|
You can also run the module in
|
Android Studio/IntelliJ or VS Code with
|
the Flutter and Dart plugins. This project contains a
|
single-view example version of your module before it’s
|
embedded in your existing application,
|
which is useful for incrementally
|
testing the Flutter-only parts of your code.<topic_end>
|
<topic_start>
|
Module organization
|
The my_flutter module directory structure is similar to a
|
normal Flutter application:Add your Dart code to the lib/ directory.Add Flutter dependencies to my_flutter/pubspec.yaml,
|
including Flutter packages and plugins.The .ios/ hidden subfolder contains an Xcode workspace where
|
you can run a standalone version of your module.
|
It is a wrapper project to bootstrap your Flutter code,
|
and contains helper scripts to facilitate building frameworks or
|
embedding the module into your existing application with CocoaPods.info Note
|
Add custom iOS code to your own existing application’s
|
project or to a plugin, not to the module’s .ios/
|
directory. Changes made in your module’s .ios/
|
directory don’t appear in your existing iOS project
|
using the module, and might be overwritten by Flutter.Do not source control the .ios/ directory since it’s autogenerated.
|
Before building the module on a new machine, run flutter pub get
|
in the my_flutter directory first to regenerate the .ios/
|
directory before building iOS project using the Flutter module.<topic_end>
|
<topic_start>
|
Embed the Flutter module in your existing application
|
After you have developed your Flutter module,
|
you can embed it using the methods described at the top of the page.info Note
|
You can run in Debug mode on a simulator or a real device,
|
and Release on a real device. Learn more about
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.