text stringlengths 1 372 |
|---|
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 |
flutter’s build modes |
to leverage flutter debugging functionality |
such as hot reload, see debugging your add-to-app module. |
using flutter increases your app size. |
<topic_end> |
<topic_start> |
option a - embed with CocoaPods and the flutter SDK |
this method requires every developer working on your |
project to have a locally installed version of the flutter SDK. |
the flutter module is compiled from source each time the app is built. |
simply build your application in xcode to automatically |
run the script to embed your dart and plugin code. |
this allows rapid iteration with the most up-to-date |
version of your flutter module without running additional |
commands outside of xcode. |
the following example assumes that your existing |
application and the flutter module are in sibling |
directories. if you have a different directory structure, |
you might need to adjust the relative paths. |
if your existing application (myapp) doesn’t |
already have a podfile, run pod init in the |
MyApp directory to create one. |
you can find more details on using |
CocoaPods in the CocoaPods getting started guide. |
add the following lines to your podfile: |
<code_start> |
flutter_application_path = '../my_flutter' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.