sql_query 0.0.1 copy "sql_query: ^0.0.1" to clipboard
sql_query: ^0.0.1 copied to clipboard

outdated

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'),
          ),
        ),
      ),
    );
  }
}
1
likes
0
pub points
3%
popularity

Publisher

unverified uploader

Extended Function for sqflite.

License

unknown (LICENSE)

Dependencies

flutter, sqflite

More

Packages that depend on sql_query