Allowed Params Error due to Instance of Variable<String> #2856
-
await batch((Batch b) async {
for (final Map<String, dynamic> json in list) {
final String verseId = json['verse_id'].toString();
final String bookId = json['book_id'].toString();
final String verseChapter = json['verse_chapter'].toString();
final String verseNumber = json['verse_number'].toString();
final String verseText = json['verse_text'].toString();
final String isRed = json['is_red'].toString();
final String bookName = json['book_name'].toString();
b.customStatement(
'INSERT INTO $verseTable (verse_id, book_id,verse_chapter,verse_number, '
'verse_text,is_red,book_name) VALUES(?,?,?,?,?,?,?)',
[
Variable.withString(verseId),
Variable.withString(bookId),
Variable.withString(verseChapter),
Variable.withString(verseNumber),
Variable.withString(verseText),
Variable.withString(isRed),
Variable.withString(bookName),
]);
} I am using Drift to do a custom statement, the custom insert with just $variables bails out due to " quotes in the strings. The above throws the drift error: flutter: [2024-01-23T10:08:51.467958] Invalid argument (params[1]): Allowed parameters must either
be null or bool, int, num, String or List<int>.: Instance of 'Variable<String>' If I remove Variable.withString() and just put the variable it won't work due to the quotes |
Beta Was this translation helpful? Give feedback.
Answered by
biblebreeze
Jan 23, 2024
Replies: 1 comment 1 reply
-
After removing the Variable.withstring() and leaving just the variables in the List, it worked. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
simolus3
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After removing the Variable.withstring() and leaving just the variables in the List, it worked.