Skip to content

Commit e55eb21

Browse files
committed
Attachments docs: Point to uses in example
1 parent 98d73e2 commit e55eb21

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

demos/supabase-todolist/lib/attachments/queue.dart

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,3 @@ Future<Attachment> savePhotoAttachment(
5353
},
5454
);
5555
}
56-
57-
Future<Attachment> deletePhotoAttachment(String fileId) async {
58-
return await attachmentQueue.deleteFile(
59-
attachmentId: fileId,
60-
updateHook: (context, attachment) async {
61-
// Optionally update relationships in the same transaction
62-
},
63-
);
64-
}

packages/powersync_core/doc/attachments.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ The attachments' state is stored in a local-only attachments table.
3333

3434
See the [supabase-todolist](https://github.com/powersync-ja/powersync.dart/tree/main/demos/supabase-todolist) demo for a basic example of attachment syncing.
3535

36+
In particular, relevant snippets from that example are:
37+
38+
- The attachment queue is set up [here](https://github.com/powersync-ja/powersync.dart/blob/98d73e2f157a697786373fef755576505abc74a5/demos/supabase-todolist/lib/attachments/queue.dart#L16-L36), using conditional imports to store attachments in the file system on native platforms and in-memory for web.
39+
- When a new attachment is added, `saveFile` is called [here](https://github.com/powersync-ja/powersync.dart/blob/98d73e2f157a697786373fef755576505abc74a5/demos/supabase-todolist/lib/attachments/queue.dart#L38-L55) and automatically updates references in the main schema to reference the attachment.
40+
3641
### Setup
3742

3843
First, add a table storing local attachment state to your database schema.

0 commit comments

Comments
 (0)