drift_local_storage_inspector 0.1.1 copy "drift_local_storage_inspector: ^0.1.1" to clipboard
drift_local_storage_inspector: ^0.1.1 copied to clipboard

outdated

A SQL local storage inspector implementation that exposes drift databases

example/lib/main.dart

import 'package:drift/native.dart';
import 'package:drift_local_storage_inspector/drift_local_storage_inspector.dart';
import 'package:flutter/material.dart';
import 'package:storage_inspector/storage_inspector.dart';

import 'db/driftdb.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  final driver = StorageServerDriver(
    bundleId: 'com.example.test',
    icon: '<some icon>',
  );

  final db = NativeDatabase.memory();
  final driftDb = MyDatabase(db);

  final res = await driftDb.customSelect("SELECT sql from sqlite_schema").get();

  final sqlServer = DriftSQLDatabaseServer(
    id: "1",
    name: "SQL server",
    database: driftDb,
  );

  driver.addSQLServer(sqlServer);

  await driver.start(paused: false);

  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headline4,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
    );
  }
}
10
likes
0
pub points
87%
popularity

Publisher

verified publisherchimerapps.com

A SQL local storage inspector implementation that exposes drift databases

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

drift, flutter, storage_inspector

More

Packages that depend on drift_local_storage_inspector