Skip to content

Commit

Permalink
v4 docs: Fix sample write/read code
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Clauss committed Mar 7, 2024
1 parent 6f4441d commit b317195
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions docs/docs/de/tutorials/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ part 'user.g.dart';
@collection
class User {
late int id; // Für auto-increment kannst du auch id = null zuweisen
late int id;
String? name;
Expand Down Expand Up @@ -56,14 +56,14 @@ Alle grundlegenden CRUD-Operationen sind über die `IsarCollection` verfügbar .
```dart
final newUser = User()..name = 'Jane Doe'..age = 36;
await isar.writeTxn(() async {
await isar.writeAsync((isar) async {
newUser.id = isar.users.autoIncrement();
await isar.users.put(newUser); // Einfügen & akualisieren
});
final existingUser = await isar.users.get(newUser.id); // Erhalten
await isar.writeTxn(() async {
await isar.writeAsync((isar) async {
await isar.users.delete(existingUser.id!); // Löschen
});
```
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/tutorials/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ All basic CRUD operations are available via the `IsarCollection`.
```dart
final newUser = User()..name = 'Jane Doe'..age = 36;
await isar.writeTxn(() async {
await isar.writeAsync((isar) async {
newUser.id = isar.users.autoIncrement();
await isar.users.put(newUser); // insert & update
});
final existingUser = await isar.users.get(newUser.id); // get
await isar.writeTxn(() async {
await isar.writeAsync((isar) async {
await isar.users.delete(existingUser.id!); // delete
});
```
Expand Down

0 comments on commit b317195

Please sign in to comment.