Flutter, sqflite, and escaping quotes with SQL INSERT and UPDATE statements
By Alvin Alexander. Last updated: October 3 2019
When you want to do a SQL INSERT
or UPDATE
using the Flutter sqflite package, I’ve found that it’s best to use their insert
and update
methods (as shown below) so you don’t have to worry about escaping single- and double-quotes. This is similar to the reason why Java developers switched from Statement to PreparedStatement way back in the late 1900s.
As an example, given this SQLite database table: