I will show you how you can achieve to manage API for Dev and Production Stage.
Step 1: Create a new constant for apiBaseUrl
In the FlutterFlow "App Values" section:
Navigate to the "Constants" tab.
Click the "+ Add App Constant" button.
Set the Field Name as "apiBaseUrl".
Set the Data Type to "String".
Enter the base URL value for your API (this could be your development or production URL).
This constant will serve as the base URL for your API calls across the app.
Step 2: Set up API Group with a group variable
In the "Define API Group" section:
Give your API group a name (e.g., "Auths Dev").
In the "API Base URL" field, enter "[apiUrl]" to use a variable.
Expand the "Group Variables" section.
Add a new variable named "apiUrl".
Set its Type to "String" and "Is List" to False.
Leave the Default Value blank for now.
This setup allows you to dynamically set the API base URL for this group.
Step 3: Apply the API URL in API calls
When setting up individual API calls within your app:
In the Backend Call configuration, select your API group (e.g., "Auths Dev").
In the Variables section of the API call, you'll see "apiUrl" listed.
Set the Value of "apiUrl" to "apiBaseUrl" (the constant we created in Step 1).
This approach allows you to:
Easily switch between development and production APIs by changing the "apiBaseUrl" constant.
Maintain consistency across all API calls in your app.
Quickly update the base URL for a group of related API endpoints.
By following these steps, you've created a flexible system for managing your API URLs across different environments (development and production) in your FlutterFlow project.