first commit
This commit is contained in:
commit
39e38f931f
382 changed files with 520450 additions and 0 deletions
29
lib/db_test.dart
Normal file
29
lib/db_test.dart
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import 'package:drift/drift.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:temperaturdecke/database.dart';
|
||||
|
||||
void addWool(BuildContext context) async {
|
||||
try {
|
||||
AppDatabase db = Provider.of<AppDatabase>(context, listen: false);
|
||||
|
||||
db.into(db.wolle).insert(WolleCompanion.insert(
|
||||
title: 'Kakapo',
|
||||
color: '#00FF05',
|
||||
manufacture: 'test',
|
||||
));
|
||||
} catch (e) {
|
||||
// Fehlerbehandlung hier
|
||||
print('Fehler beim Einfügen: $e');
|
||||
}
|
||||
}
|
||||
|
||||
void removeWool(BuildContext context, int dId) async {
|
||||
try {
|
||||
AppDatabase db = Provider.of<AppDatabase>(context, listen: false);
|
||||
|
||||
(db.delete(db.wolle)..where((t) => t.id.isValue(dId))).go();
|
||||
} catch (e) {
|
||||
print('Fehler beim Einfügen: $e');
|
||||
}
|
||||
}
|
||||
Reference in a new issue