SQLite in FlutterFlow: three silent failure cases I've encountered
I have been using SQLite in a FlutterFlow app for several months and have spent a lot of time troubleshooting various issues, specifically those involving SQLite operations that don't throw explicit errors but simply fail to work or cause malfunctions. The following information might save time for others facing similar situations:
In queries defined within the FlutterFlow SQLite panel, parameters must be written in the
${name}format. If you use?, the value isn't passed correctly; consequently, theWHEREclause fails to filter anything, leading to incorrect results or no results at all. It is important to note that${name}inserts the text exactly as is (literally); therefore, an apostrophe or any other special character in the search term can break the query.Write operations:
rawQueryis intended for read operations, so executing anINSERT,UPDATE, orDELETEcommand via this method might fail without generating visible errors. Within a Custom Action, it is preferable to userawInsert,rawUpdate, orrawDelete(FlutterFlow already distinguishes between read and update queries in its interface).Updates and new versions: users update the app from various and not always sequential versions. Consequently, it is advisable to use
ALTER TABLEonly for columns that allow null values or have a default value. Since it is impossible to know the user's starting version, it is crucial to verify that the column does not already exist before adding it; a simple check can prevent issues related to these schema changes.
What other instances of silent errors with SQLite in FlutterFlow have you encountered? I’d be curious to know.