sqlite_viewer 1.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 82

SQLite Viewer Widget #

GitHub stars GitHub last commit Open Source Love

This Flutter package provides a widget to display the contents of SQLite.

Viewer

๐Ÿ’ป Installation #

In the dependencies: section of your pubspec.yaml, add the following line:

Version

dependencies:
  sqlite_viewer: <latest version>

โ” Usage #

Import this class #

import 'package:sqlite_viewer/sqlite_viewer.dart';

Just open the page #

Navigator.push(context, MaterialPageRoute(builder: (_) => DatabaseList()))

๐Ÿ‘ Contribution #

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -m 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

๐Ÿงก Thanks #

1.0.2 #

  • Fix document

1.0.1 #

  • Fix document

1.0.0 #

  • Fix some for pub.dev

0.0.1 #

  • Initial Release

example/lib/main.dart

import 'dart:math';

import 'package:flutter/material.dart';
import 'package:sqflite/sqflite.dart';
import 'package:sqlite_viewer/sqlite_viewer.dart';

import './models/test.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData.light(),
      home: new HomeScreen()
    );
  }
}

class HomeScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: AppBar(
        title: Text('Sample'),
        actions: <Widget>[
          new IconButton(
            icon: new Icon(Icons.folder),
            onPressed: () {
                Navigator.push(context, MaterialPageRoute(builder: (_) => DatabaseList()));
            }
          ),
        ]
      ),
      floatingActionButton: FloatingActionButton(
          child: Icon(Icons.add),
          onPressed: () {
            Future<int> future = _add(Test(
              column1: _getRandom(),
              column2: _getRandom(),
              column3: _getRandom(),
            ));
            future
                .then((value) => print(value))
                .catchError((error) => print(error));
          }),
    );
  }

  Future<int> _add(Test test) async {
    final TestDatabaseProvider provider = TestDatabaseProvider();
    final Database database = await provider.database;
    return await database.insert(provider.tableName, test.toMap());
  }

  String _getRandom() {
    const _randomChars =
        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
    const _charsLength = _randomChars.length;

    final rand = new Random();
    final codeUnits = new List.generate(
      20,
      (index) {
        final n = rand.nextInt(_charsLength);
        return _randomChars.codeUnitAt(n);
      },
    );

    return String.fromCharCodes(codeUnits);
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  sqlite_viewer: ^1.0.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:sqlite_viewer/sqlite_viewer.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
65
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
82
Learn more about scoring.

We analyzed this package on Apr 4, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
json_table ^1.3.2 1.3.2
path ^1.6.4 1.6.4
sqflite ^1.1.7+3 1.3.0
Transitive dependencies
collection 1.14.11 1.14.12
json_utilities 0.1.3
meta 1.1.8
sky_engine 0.0.99
sqflite_common 1.0.0+1
synchronized 2.2.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test