sql_query 0.0.1
sql_query: ^0.0.1 copied to clipboard
Extended Function for sqflite.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:sql_query/database_model.dart';
import 'package:sql_query/sql_query.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
DB.init(
databaseName: 'testing',
tableList: [
TableDatabase(
tableName: 'testing',
column: [
ColumnDatabase(
name: 'id',
typeData: DataType.integer,
primaryKey: true,
autoIncrement: true,
),
ColumnDatabase(
name: 'name',
typeData: DataType.text,
),
],
),
],
);
initPlatformState();
}
// Platform messages are asynchronous, so we initialize in an async method.
Future<void> initPlatformState() async {}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: GestureDetector(
onTap: () async {
final res = await DB.query(
'testing',
databaseQuery: DatabaseQuery(
insert: Transaction(data: {'name': "'\"testing bremmm\"\"\"'''''"}),
),
);
print(res);
final getit = await DB.query(
'testing',
databaseQuery: DatabaseQuery(
get: Transaction(),
),
);
for (var i in getit) {
print(i);
}
},
child: const Text('Click To Run'),
),
),
),
);
}
}