You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -42,25 +42,67 @@ FlutterFlow provides two main ways to modify native files: [**Add Individual Sni
42
42
For Android, modifications are typically made in the `AndroidManifest.xml` file, where you can add the following tags:
43
43
44
44
-**Activity Tags**: This injects code inside the `<activity> ... </activity>` block. You’d use this to declare an additional activity in an Android application. An activity represents a single screen with a user interface (UI). This tag can control the behavior, orientation, and themes, and determines how the activity interacts with other apps or system events.
45
-
-**Application Tags**: [Add info after checking in Beta]
46
-
47
-
To add a snippet in the `AndroidManifest.xml` file, open **Custom Code** (from the left side navigation menu) **> Configuration Files >** select **`AndroidManifest.xml`**. [add instructions para]
48
-
49
-
[more info on this (after checking in beta) →When you add an XML snippet, you can give it a name; The name is added as a comment around the snippet in the file]
50
-
51
-
[Arcade: use example for both the tags]
45
+
-**Application Tags**: This injects code inside the `<application> ... </application>` block. You’d use this to configure `<meta-data>` entries, application-wide settings, declare app components like services, broadcast receivers, and content providers, and specify intent filters.
46
+
47
+
To add a snippet to your `AndroidManifest.xml`, navigate to **Custom Code** from the left navigation menu, select **Configuration Files**, then choose `AndroidManifest.xml`. Click the **plus** (+) button next to either the *Activity* or *Application* tag—depending on where you'd like to insert the snippet. Provide a name (this will be included as a comment in the file) and paste your snippet code.
48
+
49
+
<div style={{
50
+
position: 'relative',
51
+
paddingBottom: 'calc(56.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
For iOS, you can modify the `Info.plist` and `Entitlements.plist` files. There’s no nested application/activity structure like on Android. Instead, both files are dictionaries of key-value pairs. When you add a snippet, it’s placed directly under the root `<dict>` element of these plist files.
56
78
57
-
[write after looking at the feature in beta]
58
-
59
-
To add a snippet in iOS native files, open **Custom Code** (from the left side navigation menu) **> Configuration Files >** select desired file (`Info.plist` or `Entitlements.plist`). [add intrunctions para]
60
-
61
-
Here’s an example of adding snippet in [Info.plist] that allows [add info on what you are adding]
62
-
63
-
Here’s an example of adding snippet in [Entitlements.plist] that allows [add info on what you are adding]
79
+
To add a snippet to native iOS files, navigate to **Custom Code** (from the left-side menu) > **Configuration Files**, and select the desired file (`Info.plist` or `Entitlements.plist`). Click the **plus** (+) button, provide a descriptive name (which will appear as a comment in the file), and paste your snippet code.
80
+
81
+
<div style={{
82
+
position: 'relative',
83
+
paddingBottom: 'calc(56.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
You can also use your Development [**Environment Values**](../../testing-deployment-publishing/development-environments/development-environments.md#environment-values) and [**Library Values**](../../resources/projects/libraries.md#library-values) inside snippets. For more details, refer to the [**Include Variables in Native Code**](#include-variables-in-native-code) section.
@@ -70,11 +112,37 @@ You can also use your Development [**Environment Values**](../../testing-deploym
70
112
71
113
For more complex changes, you can enable **Manual Edit Mode**, which essentially unlocks the entire file for free-form editing. This is like opening the raw file in a text editor directly within FlutterFlow. **Note that** the Manual mode is powerful but should be used carefully.
72
114
73
-
To manually edit the native files, open **Custom Code** (from the leftside navigation menu) **> Configuration Files >** select desired file. Now [add instructions after looking in Beta]
115
+
To manually edit native files, navigate to **Custom Code** (from the left-side menu) > **Configuration Files**, select the file you want to edit, and click the **lock** button to unlock it. You can now freely modify the file.
74
116
75
-
[more info about manual edit mode from liner ticket]
117
+
:::tip
118
+
Once unlocked, the file stays in manual editing mode until you lock it again. Locking it will reset the file to a version generated by FlutterFlow.
119
+
:::
76
120
77
-
[arcade]
121
+
<div style={{
122
+
position: 'relative',
123
+
paddingBottom: 'calc(56.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
For iOS apps, you might need to configure App Transport Security (ATS) to allow non-HTTPS connections. Instead of manually setting `NSAllowsArbitraryLoads` to `true`, you can use a FlutterFlow variable:
@@ -114,6 +185,9 @@ For iOS apps, you might need to configure App Transport Security (ATS) to allow
114
185
115
186
If `ALLOW_HTTP_TRAFFIC` is set to `true` in FlutterFlow’s Environment Value, the app will allow HTTP connections.
If you are building a [FlutterFlow Library](../../resources/projects/libraries.md) and need to include API keys in native code without exposing them when users import the library, you can use [Library Values](../../resources/projects/libraries.md#library-values) as placeholders. This ensures that when someone installs your library, they can define their own values without seeing the actual key or credentials inside the native files.
@@ -130,6 +204,9 @@ For example, If your library requires an API key for a third-party service (e.g.
130
204
131
205
The library user will define their own API key under Library Values when importing your library. At build time, FlutterFlow replaces `{{MAPS_API_KEY}}` with the user-defined key.
FlutterFlow allows editing several key native files. Below, we cover each file’s role, why you might need to edit it, and examples of real-world use cases.
@@ -356,7 +433,7 @@ Here are some scenarios where you may need to modify the `main.dart` file:
356
433
357
434
Many packages have initialization calls. For example, if you added a custom package for analytics or error tracking (say Sentry or a logging service), you might need to call `SentryFlutter.init()` or set up an error handler at app startup. By placing that call in `main.dart` (before or right after `runApp`), you ensure it’s executed early.
358
435
359
-
```dart
436
+
```jsx
360
437
import'dart:async';
361
438
362
439
import'package:flutter/widgets.dart';
@@ -383,7 +460,7 @@ This ensures Sentry is ready before the app starts, just like Firebase initializ
383
460
384
461
If you want to change the status bar color and adjust icon brightness for Android and iOS, you need to modify `main.dart` before calling `runApp()`.
385
462
386
-
```dart
463
+
```jsx
387
464
388
465
import'package:flutter/services.dart';
389
466
@@ -405,7 +482,7 @@ void main() {
405
482
406
483
Some apps require landscape-only or portrait-only modes. You can enforce screen orientation in `main.dart` before launching the app.
407
484
408
-
```dart
485
+
```jsx
409
486
import'package:flutter/services.dart';
410
487
411
488
Future<void>main() async {
@@ -426,7 +503,7 @@ This ensures the app only runs in landscape mode.
426
503
427
504
If your app needs to respond to lifecycle events, such as tracking when the app goes into the background or returns to the foreground, you can attach an observer.
428
505
429
-
```dart
506
+
```jsx
430
507
import'package:flutter/widgets.dart';
431
508
432
509
voidmain() {
@@ -459,7 +536,7 @@ Here are some scenarios where you may need to modify the ProGuard file:
459
536
460
537
ProGuard can obfuscate critical libraries, breaking their functionality. To prevent this, you need to keep specific classes used by the library.
461
538
462
-
```
539
+
```jsx
463
540
# Firebase
464
541
-keep classcom.google.firebase.** { *; }
465
542
@@ -474,7 +551,7 @@ This ensures that Firebase and Gson classes are not obfuscated, preventing seria
474
551
475
552
If your app crashes in release mode but works in debug mode, ProGuard might be removing important classes. To troubleshoot, you can add logging and keep rules.
476
553
477
-
```
554
+
```jsx
478
555
-assumenosideeffects classandroid.util.Log {
479
556
publicstatic***d(...);
480
557
publicstatic***v(...);
@@ -488,7 +565,7 @@ This removes debug logs in release builds but retains them for troubleshooting.
488
565
489
566
Attackers can decompile APKs and view sensitive debug logs. To remove these debug logs, add:
490
567
491
-
```
568
+
```jsx
492
569
-dontwarn android.util.Log
493
570
```
494
571
@@ -497,7 +574,7 @@ Attackers can decompile APKs and view sensitive debug logs. To remove these debu
497
574
498
575
If your app uses native C/C++ libraries (JNI), ProGuard may mistakenly remove required components. To prevent this:
499
576
500
-
```
577
+
```jsx
501
578
-keep classcom.example.native.** { *; }
502
579
-keepclassmembers class* {
503
580
native <methods>;
@@ -510,7 +587,7 @@ This keeps all native methods intact.
510
587
511
588
Some libraries rely on reflection to dynamically call methods, which ProGuard may remove.
0 commit comments