text stringlengths 1 372 |
|---|
info note |
astute readers might notice that the flutter module |
directory also contains an .android and an |
.ios directory. those directories are flutter-tool-generated |
and are only meant to bootstrap flutter into generic |
android or iOS libraries. they should not be edited or checked-in. |
this allows flutter to improve the integration point should |
there be bugs or updates needed with new versions of gradle, |
android, android gradle plugin, etc. |
for advanced users, if more modularity is needed and you must |
not leak knowledge of your flutter module’s dependencies into |
your outer host app, you can rewrap and repackage your flutter |
module’s gradle library inside another native android gradle |
library that depends on the flutter module’s gradle library. |
you can make your android specific changes such as editing the |
AndroidManifest.xml, gradle files or adding more java files |
in that wrapper library. |
<topic_end> |
<topic_start> |
c. merging libraries |
the scenario that requires slightly more attention is if |
your existing android application already depends on the |
same android library that your flutter module |
does (transitively via a plugin). |
for instance, your existing app’s gradle might already have: |
<code_start> |
… |
dependencies { |
… |
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1' |
… |
} |
… |
<code_end> |
and your flutter module also depends on |
firebase_crashlytics via pubspec.yaml: |
<code_start> |
… |
dependencies: |
… |
firebase_crashlytics: ^0.1.3 |
… |
… |
<code_end> |
this plugin usage transitively adds a gradle dependency again via |
firebase_crashlytics v0.1.3’s own gradle file: |
<code_start> |
… |
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. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.