Skip to content

Instantly share code, notes, and snippets.

@arnold-parge
Created May 31, 2020 16:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arnold-parge/d216a51a4b6a83771586e1a148226f9c to your computer and use it in GitHub Desktop.
Save arnold-parge/d216a51a4b6a83771586e1a148226f9c to your computer and use it in GitHub Desktop.
import 'package:sqflite/sqflite.dart';
import 'package:path/path.dart';
class AppSqliteDb {
static Database sqliteDb;
static String sqliteDbName = 'db1.db';
static Future init() async {
String databasesPath = await getDatabasesPath();
String userDBPath = join(databasesPath, '$sqliteDbName');
sqliteDb = await openDatabase(
userDBPath,
version: 1,
onCreate: (Database db, int version) async {
db.execute('''CREATE TABLE IF NOT EXISTS user (
gender TEXT,
name_title TEXT,
name_first TEXT,
name_last TEXT,
location_street_name TEXT,
location_street_number TEXT,
location_city TEXT,
location_state TEXT,
location_country TEXT,
location_postcode TEXT,
location_coordinates_latitude TEXT,
location_coordinates_longitude TEXT,
location_timezone_offset TEXT,
location_timezone_description TEXT,
email TEXT,
login_uuid TEXT primary key,
login_username TEXT,
login_password TEXT,
login_salt TEXT,
login_md5 TEXT,
login_sha1 TEXT,
login_sha256 TEXT,
dob_date TEXT,
dob_age TEXT,
registered_date TEXT,
registered_age TEXT,
phone TEXT,
cell TEXT,
id_name TEXT,
id_value TEXT,
picture_large TEXT,
picture_medium TEXT,
picture_thumbnail TEXT,
nat TEXT
)''');
},
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment