dbhelper init and minsdkversion changed
This commit is contained in:
@@ -45,7 +45,7 @@ android {
|
|||||||
applicationId "com.example.get_stuff_done"
|
applicationId "com.example.get_stuff_done"
|
||||||
// You can update the following values to match your application needs.
|
// You can update the following values to match your application needs.
|
||||||
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
|
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
|
||||||
minSdkVersion flutter.minSdkVersion
|
minSdkVersion 23
|
||||||
targetSdkVersion flutter.targetSdkVersion
|
targetSdkVersion flutter.targetSdkVersion
|
||||||
versionCode flutterVersionCode.toInteger()
|
versionCode flutterVersionCode.toInteger()
|
||||||
versionName flutterVersionName
|
versionName flutterVersionName
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import 'pages/dashboard_page.dart';
|
|||||||
import 'services/dbhelper.dart';
|
import 'services/dbhelper.dart';
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
await DbHelper.init();
|
await DbHelper.init();
|
||||||
runApp(const MyApp());
|
runApp(const MyApp());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import '../models/todo.dart';
|
|||||||
|
|
||||||
class DbHelper {
|
class DbHelper {
|
||||||
static late Isar _isar;
|
static late Isar _isar;
|
||||||
|
static int get nextTodoId => _isar.todos.autoIncrement();
|
||||||
|
|
||||||
static init() async {
|
static init() async {
|
||||||
final dir = await getApplicationDocumentsDirectory();
|
final dir = await getApplicationDocumentsDirectory();
|
||||||
@@ -12,5 +13,10 @@ class DbHelper {
|
|||||||
schemas: [TodoSchema],
|
schemas: [TodoSchema],
|
||||||
directory: dir.path,
|
directory: dir.path,
|
||||||
);
|
);
|
||||||
|
var todos = [
|
||||||
|
Todo(id: nextTodoId, title: 'Get Stuff Done'),
|
||||||
|
Todo(id: nextTodoId, title: 'Some shit'),
|
||||||
|
];
|
||||||
|
_isar.write((isar) => isar.todos.putAll(todos));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user