How To Identify And Correct Issues By Testing Locally

If your app is not running as expected and there are no issues in your FlutterFlow project, the best way to identify and correct the issue is to test your app locally.
Let's consider this scenario:
You are trying to add data to your Firebase collection in Run Mode, but nothing happens when you select Book Now in your app. The FlutterFlow issue identifier doesn't detect any issues, but things are not working as expected. This indicates that you might have some other issues.

Step 1: Download and Run the code

Downloading and running the code in your preferred IDE helps you find any potential issue that is being logged in the IDE console.
You can download and run the code using the instructions here, here, and here.

Step 2: Finding the issue

  • To find the issue, run the app locally and try to add the data into the Firebase collection.
  • While adding data, your IDE must have logged some information (in console) starting with [ERROR:flutter/lib/ui/]
  • Read the text a after [ERROR:flutter/lib/ui/]. This should give you the hint about the exact error. In the current example, it has a text as Unhandled Exception: FormatException which means, you may have passed the wrong data type into a Field or the data type for Field is different from what you are passing.
If you are not sure what the error text means, copy-paste the entire error text in Google or Stackoverflow. You should find many articles that help explain what the error means.
  • To find the exact place where the error is happening, click the first link text in the console.
  • Identify the issue where the cursor is placed.
In the current example, the type field is expecting Integer and the data passed is in String format. This leads to a FormatException error.

Step 3: Fixing the issue

Once you have identified the issue you can make a fix in FlutterFlow.
Steps to fix the issue are dependant on the type of issue.
In the current example, there is a data mismatch issue with the Field: the type field is defined as an integer in the Firestore collection, but a string in the action.
There are two fixes you can make:
  • Update the action to pass the correct data type. For example, if the data type for the Field is set to Integer you must pass the number.
  • Change the data type of the Field in your Firestore collection to match the data type being passed in the action.