Skip to content

Instantly share code, notes, and snippets.

@knaeckeKami
Created September 20, 2019 15:05
Show Gist options
  • Save knaeckeKami/8fafa26fab6bf830e0457f4566dc71de to your computer and use it in GitHub Desktop.
Save knaeckeKami/8fafa26fab6bf830e0457f4566dc71de to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
import 'package:moor_bug_minimal/db.dart';
import 'package:moor_flutter/moor_flutter.dart';
void main() async {
Db db = Db();
await (db.into(db.dummyTable).insertAll(
[DummyTableData(id: 1), DummyTableData(id: 2), DummyTableData(id: 3)]));
const paramList = [1, 2, 3];
final result = await db.selectByIds(paramList);
if (result.isEmpty) {
debugPrint("i don't work");
} else {
debugPrint("i work");
}
final result2 = await db.customSelect(
'select * from dummy_table where id in (?,?,?)',
variables: [
for (var $ in paramList) Variable.withInt($),
]);
if (result2.isEmpty) {
debugPrint("i don't work");
} else {
debugPrint("i work");
}
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return SizedBox.shrink();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment