diff --git a/docs/docs/Examples/flutter.md b/docs/docs/Examples/flutter.md
new file mode 100644
index 000000000..422b2ad97
--- /dev/null
+++ b/docs/docs/Examples/flutter.md
@@ -0,0 +1,17 @@
+---
+
+title: Flutter
+description: An example app using drift in a Flutter app
+
+---
+
+For a comprehensive example of a cross-platform Flutter app that incorporates drift and follows best practices, refer to the [app example](https://github.com/simolus3/drift/tree/develop/examples/app) in drift's repository.
+
+This example serves as an excellent starting point for users interested in exploring how to integrate drift into a Flutter app with a modern architecture.
+
+
+
+
+[:simple-github: Github](https://github.com/simolus3/drift/tree/develop/examples/app){ .md-button .md-button--primary }
+
+
diff --git a/docs/mkdocs/mkdocs.yml b/docs/mkdocs/mkdocs.yml
index fc529bb1a..0a49aef27 100644
--- a/docs/mkdocs/mkdocs.yml
+++ b/docs/mkdocs/mkdocs.yml
@@ -134,11 +134,11 @@ nav:
- upgrading.md
- Examples:
- Examples/index.md
+ - Examples/flutter.md
- Examples/relationships.md
- Examples/tracing.md
- Examples/server_sync.md
- Examples/existing_databases.md
- - Examples/more.md
- Tools:
- Tools/index.md
- Tools/devtools.md
diff --git a/examples/app/.metadata b/examples/app/.metadata
index 391c336b2..009f8afe9 100644
--- a/examples/app/.metadata
+++ b/examples/app/.metadata
@@ -4,7 +4,7 @@
# This file should be version controlled and should not be manually edited.
version:
- revision: "5874a72aa4c779a02553007c47dacbefba2374dc"
+ revision: "efbf63d9c66b9f6ec30e9ad4611189aa80003d31"
channel: "stable"
project_type: app
@@ -13,26 +13,26 @@ project_type: app
migration:
platforms:
- platform: root
- create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
- base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
+ create_revision: efbf63d9c66b9f6ec30e9ad4611189aa80003d31
+ base_revision: efbf63d9c66b9f6ec30e9ad4611189aa80003d31
- platform: android
- create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
- base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
+ create_revision: efbf63d9c66b9f6ec30e9ad4611189aa80003d31
+ base_revision: efbf63d9c66b9f6ec30e9ad4611189aa80003d31
- platform: ios
- create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
- base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
+ create_revision: efbf63d9c66b9f6ec30e9ad4611189aa80003d31
+ base_revision: efbf63d9c66b9f6ec30e9ad4611189aa80003d31
- platform: linux
- create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
- base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
+ create_revision: efbf63d9c66b9f6ec30e9ad4611189aa80003d31
+ base_revision: efbf63d9c66b9f6ec30e9ad4611189aa80003d31
- platform: macos
- create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
- base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
+ create_revision: efbf63d9c66b9f6ec30e9ad4611189aa80003d31
+ base_revision: efbf63d9c66b9f6ec30e9ad4611189aa80003d31
- platform: web
- create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
- base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
+ create_revision: efbf63d9c66b9f6ec30e9ad4611189aa80003d31
+ base_revision: efbf63d9c66b9f6ec30e9ad4611189aa80003d31
- platform: windows
- create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
- base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc
+ create_revision: efbf63d9c66b9f6ec30e9ad4611189aa80003d31
+ base_revision: efbf63d9c66b9f6ec30e9ad4611189aa80003d31
# User provided section
diff --git a/examples/app/android/.gitignore b/examples/app/android/.gitignore
index 55afd919c..6f568019d 100644
--- a/examples/app/android/.gitignore
+++ b/examples/app/android/.gitignore
@@ -7,7 +7,7 @@ gradle-wrapper.jar
GeneratedPluginRegistrant.java
# Remember to never publicly share your keystore.
-# See https://flutter.dev/to/reference-keystore
+# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties
**/*.keystore
**/*.jks
diff --git a/examples/app/android/app/build.gradle b/examples/app/android/app/build.gradle
index 54b6d53c0..afc95aa05 100644
--- a/examples/app/android/app/build.gradle
+++ b/examples/app/android/app/build.gradle
@@ -1,44 +1,72 @@
-plugins {
- id "com.android.application"
- id "kotlin-android"
- // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
- id "dev.flutter.flutter-gradle-plugin"
+def localProperties = new Properties()
+def localPropertiesFile = rootProject.file('local.properties')
+if (localPropertiesFile.exists()) {
+ localPropertiesFile.withReader('UTF-8') { reader ->
+ localProperties.load(reader)
+ }
+}
+
+def flutterRoot = localProperties.getProperty('flutter.sdk')
+if (flutterRoot == null) {
+ throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
+}
+
+def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
+if (flutterVersionCode == null) {
+ flutterVersionCode = '1'
+}
+
+def flutterVersionName = localProperties.getProperty('flutter.versionName')
+if (flutterVersionName == null) {
+ flutterVersionName = '1.0'
}
+apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
+
android {
- namespace = "com.example.app"
- compileSdk = flutter.compileSdkVersion
- ndkVersion = flutter.ndkVersion
+ compileSdkVersion flutter.compileSdkVersion
compileOptions {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
- jvmTarget = JavaVersion.VERSION_1_8
+ jvmTarget = '1.8'
+ }
+
+ sourceSets {
+ main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
- applicationId = "com.example.app"
- // You can update the following values to match your application needs.
- // For more information, see: https://flutter.dev/to/review-gradle-config.
- minSdk = flutter.minSdkVersion
- targetSdk = flutter.targetSdkVersion
- versionCode = flutter.versionCode
- versionName = flutter.versionName
+ applicationId "com.example.app"
+ minSdkVersion flutter.minSdkVersion
+ targetSdkVersion flutter.targetSdkVersion
+ versionCode flutterVersionCode.toInteger()
+ versionName flutterVersionName
+
+ ndk {
+ abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86_64'
+ }
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
- signingConfig = signingConfigs.debug
+ signingConfig signingConfigs.debug
}
}
}
flutter {
- source = "../.."
+ source '../..'
+}
+
+dependencies {
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
diff --git a/examples/app/android/app/src/debug/AndroidManifest.xml b/examples/app/android/app/src/debug/AndroidManifest.xml
index 399f6981d..99f406bd5 100644
--- a/examples/app/android/app/src/debug/AndroidManifest.xml
+++ b/examples/app/android/app/src/debug/AndroidManifest.xml
@@ -1,6 +1,6 @@
-
-
diff --git a/examples/app/android/app/src/main/AndroidManifest.xml b/examples/app/android/app/src/main/AndroidManifest.xml
index 6ee3df00c..3f2d4034f 100644
--- a/examples/app/android/app/src/main/AndroidManifest.xml
+++ b/examples/app/android/app/src/main/AndroidManifest.xml
@@ -1,5 +1,6 @@
-
-
+
@@ -7,7 +8,6 @@
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
- android:taskAffinity=""
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
@@ -31,15 +31,4 @@
android:name="flutterEmbedding"
android:value="2" />
-
-
-
-
-
-
-
diff --git a/examples/app/android/app/src/main/kotlin/com/example/app/MainActivity.kt b/examples/app/android/app/src/main/kotlin/com/example/app/MainActivity.kt
index 026d9a938..461fcfba3 100644
--- a/examples/app/android/app/src/main/kotlin/com/example/app/MainActivity.kt
+++ b/examples/app/android/app/src/main/kotlin/com/example/app/MainActivity.kt
@@ -2,4 +2,5 @@ package com.example.app
import io.flutter.embedding.android.FlutterActivity
-class MainActivity: FlutterActivity()
+class MainActivity: FlutterActivity() {
+}
diff --git a/examples/app/android/app/src/main/res/values-night/styles.xml b/examples/app/android/app/src/main/res/values-night/styles.xml
index 06952be74..3db14bb53 100644
--- a/examples/app/android/app/src/main/res/values-night/styles.xml
+++ b/examples/app/android/app/src/main/res/values-night/styles.xml
@@ -3,7 +3,7 @@
diff --git a/examples/app/android/build.gradle b/examples/app/android/build.gradle
index d2ffbffa4..5da9e951e 100644
--- a/examples/app/android/build.gradle
+++ b/examples/app/android/build.gradle
@@ -1,3 +1,17 @@
+
+buildscript {
+ ext.kotlin_version = '1.6.10'
+ repositories {
+ google()
+ mavenCentral()
+ }
+
+ dependencies {
+ classpath 'com.android.tools.build:gradle:7.4.2'
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
+ }
+}
+
allprojects {
repositories {
google()
@@ -5,12 +19,12 @@ allprojects {
}
}
-rootProject.buildDir = "../build"
+rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
- project.evaluationDependsOn(":app")
+ project.evaluationDependsOn(':app')
}
tasks.register("clean", Delete) {
diff --git a/examples/app/android/gradle.properties b/examples/app/android/gradle.properties
index 259717082..94adc3a3f 100644
--- a/examples/app/android/gradle.properties
+++ b/examples/app/android/gradle.properties
@@ -1,3 +1,3 @@
-org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError
+org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
diff --git a/examples/app/android/gradle/wrapper/gradle-wrapper.properties b/examples/app/android/gradle/wrapper/gradle-wrapper.properties
index e1ca574ef..6b665338b 100644
--- a/examples/app/android/gradle/wrapper/gradle-wrapper.properties
+++ b/examples/app/android/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,6 @@
+#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
diff --git a/examples/app/android/settings.gradle b/examples/app/android/settings.gradle
index 536165d35..44e62bcf0 100644
--- a/examples/app/android/settings.gradle
+++ b/examples/app/android/settings.gradle
@@ -1,25 +1,11 @@
-pluginManagement {
- def flutterSdkPath = {
- def properties = new Properties()
- file("local.properties").withInputStream { properties.load(it) }
- def flutterSdkPath = properties.getProperty("flutter.sdk")
- assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
- return flutterSdkPath
- }()
+include ':app'
- includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
+def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
+def properties = new Properties()
- repositories {
- google()
- mavenCentral()
- gradlePluginPortal()
- }
-}
+assert localPropertiesFile.exists()
+localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
-plugins {
- id "dev.flutter.flutter-plugin-loader" version "1.0.0"
- id "com.android.application" version "7.3.0" apply false
- id "org.jetbrains.kotlin.android" version "1.7.10" apply false
-}
-
-include ":app"
+def flutterSdkPath = properties.getProperty("flutter.sdk")
+assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
+apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
diff --git a/examples/app/lib/database/database.g.dart b/examples/app/lib/database/database.g.dart
index 5dd2ff59a..9cf9ce9a0 100644
--- a/examples/app/lib/database/database.g.dart
+++ b/examples/app/lib/database/database.g.dart
@@ -127,14 +127,6 @@ class Category extends DataClass implements Insertable {
name: name ?? this.name,
color: color ?? this.color,
);
- Category copyWithCompanion(CategoriesCompanion data) {
- return Category(
- id: data.id.present ? data.id.value : this.id,
- name: data.name.present ? data.name.value : this.name,
- color: data.color.present ? data.color.value : this.color,
- );
- }
-
@override
String toString() {
return (StringBuffer('Category(')
@@ -381,16 +373,6 @@ class TodoEntry extends DataClass implements Insertable {
category: category.present ? category.value : this.category,
dueDate: dueDate.present ? dueDate.value : this.dueDate,
);
- TodoEntry copyWithCompanion(TodoEntriesCompanion data) {
- return TodoEntry(
- id: data.id.present ? data.id.value : this.id,
- description:
- data.description.present ? data.description.value : this.description,
- category: data.category.present ? data.category.value : this.category,
- dueDate: data.dueDate.present ? data.dueDate.value : this.dueDate,
- );
- }
-
@override
String toString() {
return (StringBuffer('TodoEntry(')
@@ -583,13 +565,6 @@ class TextEntry extends DataClass implements Insertable {
TextEntry copyWith({String? description}) => TextEntry(
description: description ?? this.description,
);
- TextEntry copyWithCompanion(TextEntriesCompanion data) {
- return TextEntry(
- description:
- data.description.present ? data.description.value : this.description,
- );
- }
-
@override
String toString() {
return (StringBuffer('TextEntry(')
@@ -659,7 +634,7 @@ class TextEntriesCompanion extends UpdateCompanion {
abstract class _$AppDatabase extends GeneratedDatabase {
_$AppDatabase(QueryExecutor e) : super(e);
- $AppDatabaseManager get managers => $AppDatabaseManager(this);
+ _$AppDatabaseManager get managers => _$AppDatabaseManager(this);
late final $CategoriesTable categories = $CategoriesTable(this);
late final $TodoEntriesTable todoEntries = $TodoEntriesTable(this);
late final TextEntries textEntries = TextEntries(this);
@@ -744,7 +719,7 @@ abstract class _$AppDatabase extends GeneratedDatabase {
);
}
-typedef $$CategoriesTableCreateCompanionBuilder = CategoriesCompanion Function({
+typedef $$CategoriesTableInsertCompanionBuilder = CategoriesCompanion Function({
Value id,
required String name,
required Color color,
@@ -755,24 +730,58 @@ typedef $$CategoriesTableUpdateCompanionBuilder = CategoriesCompanion Function({
Value color,
});
-final class $$CategoriesTableReferences
- extends BaseReferences<_$AppDatabase, $CategoriesTable, Category> {
- $$CategoriesTableReferences(super.$_db, super.$_table, super.$_typedResult);
-
- static MultiTypedResultKey<$TodoEntriesTable, List>
- _todoEntriesRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
- db.todoEntries,
- aliasName:
- $_aliasNameGenerator(db.categories.id, db.todoEntries.category));
-
- $$TodoEntriesTableProcessedTableManager get todoEntriesRefs {
- final manager = $$TodoEntriesTableTableManager($_db, $_db.todoEntries)
- .filter((f) => f.category.id($_item.id));
+class $$CategoriesTableTableManager extends RootTableManager<
+ _$AppDatabase,
+ $CategoriesTable,
+ Category,
+ $$CategoriesTableFilterComposer,
+ $$CategoriesTableOrderingComposer,
+ $$CategoriesTableProcessedTableManager,
+ $$CategoriesTableInsertCompanionBuilder,
+ $$CategoriesTableUpdateCompanionBuilder> {
+ $$CategoriesTableTableManager(_$AppDatabase db, $CategoriesTable table)
+ : super(TableManagerState(
+ db: db,
+ table: table,
+ filteringComposer:
+ $$CategoriesTableFilterComposer(ComposerState(db, table)),
+ orderingComposer:
+ $$CategoriesTableOrderingComposer(ComposerState(db, table)),
+ getChildManagerBuilder: (p) =>
+ $$CategoriesTableProcessedTableManager(p),
+ getUpdateCompanionBuilder: ({
+ Value id = const Value.absent(),
+ Value name = const Value.absent(),
+ Value color = const Value.absent(),
+ }) =>
+ CategoriesCompanion(
+ id: id,
+ name: name,
+ color: color,
+ ),
+ getInsertCompanionBuilder: ({
+ Value id = const Value.absent(),
+ required String name,
+ required Color color,
+ }) =>
+ CategoriesCompanion.insert(
+ id: id,
+ name: name,
+ color: color,
+ ),
+ ));
+}
- final cache = $_typedResult.readTableOrNull(_todoEntriesRefsTable($_db));
- return ProcessedTableManager(
- manager.$state.copyWith(prefetchedData: cache));
- }
+class $$CategoriesTableProcessedTableManager extends ProcessedTableManager<
+ _$AppDatabase,
+ $CategoriesTable,
+ Category,
+ $$CategoriesTableFilterComposer,
+ $$CategoriesTableOrderingComposer,
+ $$CategoriesTableProcessedTableManager,
+ $$CategoriesTableInsertCompanionBuilder,
+ $$CategoriesTableUpdateCompanionBuilder> {
+ $$CategoriesTableProcessedTableManager(super.$state);
}
class $$CategoriesTableFilterComposer
@@ -828,120 +837,77 @@ class $$CategoriesTableOrderingComposer
ColumnOrderings(column, joinBuilders: joinBuilders));
}
-class $$CategoriesTableTableManager extends RootTableManager<
+typedef $$TodoEntriesTableInsertCompanionBuilder = TodoEntriesCompanion
+ Function({
+ Value id,
+ required String description,
+ Value category,
+ Value dueDate,
+});
+typedef $$TodoEntriesTableUpdateCompanionBuilder = TodoEntriesCompanion
+ Function({
+ Value id,
+ Value description,
+ Value category,
+ Value dueDate,
+});
+
+class $$TodoEntriesTableTableManager extends RootTableManager<
_$AppDatabase,
- $CategoriesTable,
- Category,
- $$CategoriesTableFilterComposer,
- $$CategoriesTableOrderingComposer,
- $$CategoriesTableCreateCompanionBuilder,
- $$CategoriesTableUpdateCompanionBuilder,
- (Category, $$CategoriesTableReferences),
- Category,
- PrefetchHooks Function({bool todoEntriesRefs})> {
- $$CategoriesTableTableManager(_$AppDatabase db, $CategoriesTable table)
+ $TodoEntriesTable,
+ TodoEntry,
+ $$TodoEntriesTableFilterComposer,
+ $$TodoEntriesTableOrderingComposer,
+ $$TodoEntriesTableProcessedTableManager,
+ $$TodoEntriesTableInsertCompanionBuilder,
+ $$TodoEntriesTableUpdateCompanionBuilder> {
+ $$TodoEntriesTableTableManager(_$AppDatabase db, $TodoEntriesTable table)
: super(TableManagerState(
db: db,
table: table,
filteringComposer:
- $$CategoriesTableFilterComposer(ComposerState(db, table)),
+ $$TodoEntriesTableFilterComposer(ComposerState(db, table)),
orderingComposer:
- $$CategoriesTableOrderingComposer(ComposerState(db, table)),
- updateCompanionCallback: ({
+ $$TodoEntriesTableOrderingComposer(ComposerState(db, table)),
+ getChildManagerBuilder: (p) =>
+ $$TodoEntriesTableProcessedTableManager(p),
+ getUpdateCompanionBuilder: ({
Value id = const Value.absent(),
- Value name = const Value.absent(),
- Value color = const Value.absent(),
+ Value description = const Value.absent(),
+ Value category = const Value.absent(),
+ Value dueDate = const Value.absent(),
}) =>
- CategoriesCompanion(
+ TodoEntriesCompanion(
id: id,
- name: name,
- color: color,
+ description: description,
+ category: category,
+ dueDate: dueDate,
),
- createCompanionCallback: ({
+ getInsertCompanionBuilder: ({
Value id = const Value.absent(),
- required String name,
- required Color color,
+ required String description,
+ Value category = const Value.absent(),
+ Value dueDate = const Value.absent(),
}) =>
- CategoriesCompanion.insert(
+ TodoEntriesCompanion.insert(
id: id,
- name: name,
- color: color,
+ description: description,
+ category: category,
+ dueDate: dueDate,
),
- withReferenceMapper: (p0) => p0
- .map((e) => (
- e.readTable(table),
- $$CategoriesTableReferences(db, table, e)
- ))
- .toList(),
- prefetchHooksCallback: ({todoEntriesRefs = false}) {
- return PrefetchHooks(
- db: db,
- explicitlyWatchedTables: [if (todoEntriesRefs) db.todoEntries],
- addJoins: null,
- getPrefetchedDataCallback: (items) async {
- return [
- if (todoEntriesRefs)
- await $_getPrefetchedData(
- currentTable: table,
- referencedTable: $$CategoriesTableReferences
- ._todoEntriesRefsTable(db),
- managerFromTypedResult: (p0) =>
- $$CategoriesTableReferences(db, table, p0)
- .todoEntriesRefs,
- referencedItemsForCurrentItem: (item,
- referencedItems) =>
- referencedItems.where((e) => e.category == item.id),
- typedResults: items)
- ];
- },
- );
- },
));
}
-typedef $$CategoriesTableProcessedTableManager = ProcessedTableManager<
+class $$TodoEntriesTableProcessedTableManager extends ProcessedTableManager<
_$AppDatabase,
- $CategoriesTable,
- Category,
- $$CategoriesTableFilterComposer,
- $$CategoriesTableOrderingComposer,
- $$CategoriesTableCreateCompanionBuilder,
- $$CategoriesTableUpdateCompanionBuilder,
- (Category, $$CategoriesTableReferences),
- Category,
- PrefetchHooks Function({bool todoEntriesRefs})>;
-typedef $$TodoEntriesTableCreateCompanionBuilder = TodoEntriesCompanion
- Function({
- Value id,
- required String description,
- Value category,
- Value dueDate,
-});
-typedef $$TodoEntriesTableUpdateCompanionBuilder = TodoEntriesCompanion
- Function({
- Value id,
- Value description,
- Value category,
- Value dueDate,
-});
-
-final class $$TodoEntriesTableReferences
- extends BaseReferences<_$AppDatabase, $TodoEntriesTable, TodoEntry> {
- $$TodoEntriesTableReferences(super.$_db, super.$_table, super.$_typedResult);
-
- static $CategoriesTable _categoryTable(_$AppDatabase db) =>
- db.categories.createAlias(
- $_aliasNameGenerator(db.todoEntries.category, db.categories.id));
-
- $$CategoriesTableProcessedTableManager? get category {
- if ($_item.category == null) return null;
- final manager = $$CategoriesTableTableManager($_db, $_db.categories)
- .filter((f) => f.id($_item.category!));
- final item = $_typedResult.readTableOrNull(_categoryTable($_db));
- if (item == null) return manager;
- return ProcessedTableManager(
- manager.$state.copyWith(prefetchedData: [item]));
- }
+ $TodoEntriesTable,
+ TodoEntry,
+ $$TodoEntriesTableFilterComposer,
+ $$TodoEntriesTableOrderingComposer,
+ $$TodoEntriesTableProcessedTableManager,
+ $$TodoEntriesTableInsertCompanionBuilder,
+ $$TodoEntriesTableUpdateCompanionBuilder> {
+ $$TodoEntriesTableProcessedTableManager(super.$state);
}
class $$TodoEntriesTableFilterComposer
@@ -1006,104 +972,7 @@ class $$TodoEntriesTableOrderingComposer
}
}
-class $$TodoEntriesTableTableManager extends RootTableManager<
- _$AppDatabase,
- $TodoEntriesTable,
- TodoEntry,
- $$TodoEntriesTableFilterComposer,
- $$TodoEntriesTableOrderingComposer,
- $$TodoEntriesTableCreateCompanionBuilder,
- $$TodoEntriesTableUpdateCompanionBuilder,
- (TodoEntry, $$TodoEntriesTableReferences),
- TodoEntry,
- PrefetchHooks Function({bool category})> {
- $$TodoEntriesTableTableManager(_$AppDatabase db, $TodoEntriesTable table)
- : super(TableManagerState(
- db: db,
- table: table,
- filteringComposer:
- $$TodoEntriesTableFilterComposer(ComposerState(db, table)),
- orderingComposer:
- $$TodoEntriesTableOrderingComposer(ComposerState(db, table)),
- updateCompanionCallback: ({
- Value id = const Value.absent(),
- Value description = const Value.absent(),
- Value category = const Value.absent(),
- Value dueDate = const Value.absent(),
- }) =>
- TodoEntriesCompanion(
- id: id,
- description: description,
- category: category,
- dueDate: dueDate,
- ),
- createCompanionCallback: ({
- Value id = const Value.absent(),
- required String description,
- Value category = const Value.absent(),
- Value dueDate = const Value.absent(),
- }) =>
- TodoEntriesCompanion.insert(
- id: id,
- description: description,
- category: category,
- dueDate: dueDate,
- ),
- withReferenceMapper: (p0) => p0
- .map((e) => (
- e.readTable(table),
- $$TodoEntriesTableReferences(db, table, e)
- ))
- .toList(),
- prefetchHooksCallback: ({category = false}) {
- return PrefetchHooks(
- db: db,
- explicitlyWatchedTables: [],
- addJoins: <
- T extends TableManagerState<
- dynamic,
- dynamic,
- dynamic,
- dynamic,
- dynamic,
- dynamic,
- dynamic,
- dynamic,
- dynamic,
- dynamic>>(state) {
- if (category) {
- state = state.withJoin(
- currentTable: table,
- currentColumn: table.category,
- referencedTable:
- $$TodoEntriesTableReferences._categoryTable(db),
- referencedColumn:
- $$TodoEntriesTableReferences._categoryTable(db).id,
- ) as T;
- }
-
- return state;
- },
- getPrefetchedDataCallback: (items) async {
- return [];
- },
- );
- },
- ));
-}
-
-typedef $$TodoEntriesTableProcessedTableManager = ProcessedTableManager<
- _$AppDatabase,
- $TodoEntriesTable,
- TodoEntry,
- $$TodoEntriesTableFilterComposer,
- $$TodoEntriesTableOrderingComposer,
- $$TodoEntriesTableCreateCompanionBuilder,
- $$TodoEntriesTableUpdateCompanionBuilder,
- (TodoEntry, $$TodoEntriesTableReferences),
- TodoEntry,
- PrefetchHooks Function({bool category})>;
-typedef $TextEntriesCreateCompanionBuilder = TextEntriesCompanion Function({
+typedef $TextEntriesInsertCompanionBuilder = TextEntriesCompanion Function({
required String description,
Value rowid,
});
@@ -1112,35 +981,15 @@ typedef $TextEntriesUpdateCompanionBuilder = TextEntriesCompanion Function({
Value rowid,
});
-class $TextEntriesFilterComposer
- extends FilterComposer<_$AppDatabase, TextEntries> {
- $TextEntriesFilterComposer(super.$state);
- ColumnFilters get description => $state.composableBuilder(
- column: $state.table.description,
- builder: (column, joinBuilders) =>
- ColumnFilters(column, joinBuilders: joinBuilders));
-}
-
-class $TextEntriesOrderingComposer
- extends OrderingComposer<_$AppDatabase, TextEntries> {
- $TextEntriesOrderingComposer(super.$state);
- ColumnOrderings get description => $state.composableBuilder(
- column: $state.table.description,
- builder: (column, joinBuilders) =>
- ColumnOrderings(column, joinBuilders: joinBuilders));
-}
-
class $TextEntriesTableManager extends RootTableManager<
_$AppDatabase,
TextEntries,
TextEntry,
$TextEntriesFilterComposer,
$TextEntriesOrderingComposer,
- $TextEntriesCreateCompanionBuilder,
- $TextEntriesUpdateCompanionBuilder,
- (TextEntry, BaseReferences<_$AppDatabase, TextEntries, TextEntry>),
- TextEntry,
- PrefetchHooks Function()> {
+ $TextEntriesProcessedTableManager,
+ $TextEntriesInsertCompanionBuilder,
+ $TextEntriesUpdateCompanionBuilder> {
$TextEntriesTableManager(_$AppDatabase db, TextEntries table)
: super(TableManagerState(
db: db,
@@ -1149,7 +998,8 @@ class $TextEntriesTableManager extends RootTableManager<
$TextEntriesFilterComposer(ComposerState(db, table)),
orderingComposer:
$TextEntriesOrderingComposer(ComposerState(db, table)),
- updateCompanionCallback: ({
+ getChildManagerBuilder: (p) => $TextEntriesProcessedTableManager(p),
+ getUpdateCompanionBuilder: ({
Value description = const Value.absent(),
Value rowid = const Value.absent(),
}) =>
@@ -1157,7 +1007,7 @@ class $TextEntriesTableManager extends RootTableManager<
description: description,
rowid: rowid,
),
- createCompanionCallback: ({
+ getInsertCompanionBuilder: ({
required String description,
Value rowid = const Value.absent(),
}) =>
@@ -1165,28 +1015,42 @@ class $TextEntriesTableManager extends RootTableManager<
description: description,
rowid: rowid,
),
- withReferenceMapper: (p0) => p0
- .map((e) => (e.readTable(table), BaseReferences(db, table, e)))
- .toList(),
- prefetchHooksCallback: null,
));
}
-typedef $TextEntriesProcessedTableManager = ProcessedTableManager<
+class $TextEntriesProcessedTableManager extends ProcessedTableManager<
_$AppDatabase,
TextEntries,
TextEntry,
$TextEntriesFilterComposer,
$TextEntriesOrderingComposer,
- $TextEntriesCreateCompanionBuilder,
- $TextEntriesUpdateCompanionBuilder,
- (TextEntry, BaseReferences<_$AppDatabase, TextEntries, TextEntry>),
- TextEntry,
- PrefetchHooks Function()>;
+ $TextEntriesProcessedTableManager,
+ $TextEntriesInsertCompanionBuilder,
+ $TextEntriesUpdateCompanionBuilder> {
+ $TextEntriesProcessedTableManager(super.$state);
+}
+
+class $TextEntriesFilterComposer
+ extends FilterComposer<_$AppDatabase, TextEntries> {
+ $TextEntriesFilterComposer(super.$state);
+ ColumnFilters get description => $state.composableBuilder(
+ column: $state.table.description,
+ builder: (column, joinBuilders) =>
+ ColumnFilters(column, joinBuilders: joinBuilders));
+}
+
+class $TextEntriesOrderingComposer
+ extends OrderingComposer<_$AppDatabase, TextEntries> {
+ $TextEntriesOrderingComposer(super.$state);
+ ColumnOrderings get description => $state.composableBuilder(
+ column: $state.table.description,
+ builder: (column, joinBuilders) =>
+ ColumnOrderings(column, joinBuilders: joinBuilders));
+}
-class $AppDatabaseManager {
+class _$AppDatabaseManager {
final _$AppDatabase _db;
- $AppDatabaseManager(this._db);
+ _$AppDatabaseManager(this._db);
$$CategoriesTableTableManager get categories =>
$$CategoriesTableTableManager(_db, _db.categories);
$$TodoEntriesTableTableManager get todoEntries =>