In flutter, when I perform a listRows function for my table which contains various relationships in addition to normal data, I am not getting the relationships that have lists (i.e many to many), just the ones that have one relationship value (i.e. Many to One). Any thoughts on this? I will post code in the comments.
This is my JSON output directly from the row in the appwrite console { "$id": "693bb0330037eb3870ed", "$sequence": 2, "$createdAt": "2025-12-12T06:34:20.279+00:00", "$updatedAt": "2025-12-12T06:34:20.279+00:00", "$permissions": [], "gymId": { "gymName": "My Gym", "website": "mygym.com", "phoneNumber": null, "$id": "693bb0260017d08b390e", "$sequence": 1, "$createdAt": "2025-12-12T06:03:18.281+00:00", "$updatedAt": "2025-12-12T06:33:40.895+00:00", "$permissions": [], "gymManagerId": null, "address": null, "$databaseId": "690acc180012566b56c2", "$tableId": "gyms" }, "boardModerators": [ { "username": "whiskeycron", "igHandle": "", "isPrivate": true, "gradeSystem": "Hueco", "$id": "691205cba21c082802dc", "$sequence": 12, "$createdAt": "2025-12-12T06:35:47.883+00:00", "$updatedAt": "2025-12-12T06:35:47.883+00:00", "$permissions": [], "690adde6002f6541d7d0": "693bb75a003223332215", "$databaseId": "690acc180012566b56c2", "$tableId": "users" } ], "$databaseId": "690acc180012566b56c2", "$tableId": "gymboards" }
I put this print statement in and get the following results: for (var key in doc.data.keys) { print('Key: $key, Value: ${doc.data[key]}'); }
Results: flutter (28085): Key: $id, Value: 693bb0330037eb3870ed I/flutter (28085): Key: $sequence, Value: 2 I/flutter (28085): Key: $createdAt, Value: 2025-12-12T06:34:20.279+00:00 I/flutter (28085): Key: $updatedAt, Value: 2025-12-12T06:34:20.279+00:00 I/flutter (28085): Key: $permissions, Value: [] I/flutter (28085): Key: gymId, Value: 693bb0260017d08b390e I/flutter (28085): Key: $databaseId, Value: 690acc180012566b56c2 I/flutter (28085): Key: $tableId, Value: gymboards
As you can see, "gymId" is a relationship and it shows up, but I cannot get "boardModerators" to show up
What is your code, what version of the flutter SDK do you have, and what version of Appwrite do you have?
might not be the best setup, but I have a class that has two subclasses. So I have a table for each and I run this to pull the data using listRows final results = await Future.wait([ AppwriteService.tablesDB.listRows( databaseId: AppwriteDatabases.appwriteDatabaseID, tableId: AppwriteDatabases.boardsTable ), AppwriteService.tablesDB.listRows( databaseId: AppwriteDatabases.appwriteDatabaseID, tableId: AppwriteDatabases.homeBoardsTable ), AppwriteService.tablesDB.listRows( databaseId: AppwriteDatabases.appwriteDatabaseID, tableId: AppwriteDatabases.gymBoardsTable ), ]);
Then it performs this final boardsMap = <String, Map<String, dynamic>>{ for (var doc in results[0].rows) doc.$id: doc.data };
for (var doc in results[1].rows) {
final baseData = boardsMap[doc.$id];
if (baseData != null) {
final homeboard = HomeBoard(
boardOwner: doc.data['boardOwner'],
isPrivate: doc.data['isPrivate'],
userWhitelist: doc.data['userWhitelist'],
boardId: doc.$id,
boardName: baseData['boardName'],
)
..boardAngle = baseData['boardAngle'] ?? 0
..dateCreated = DateTime.parse(doc.$createdAt)
..dateSetUpdated = DateTime.parse(doc.$updatedAt);
if (homeboard.isPrivate &&
homeboard.isBoardVisible(
homeboard.userWhitelist,
homeboard.boardOwner,
authProvider.currentUser!.$id
)) {
tempBoards.add(homeboard);
} else if (!homeboard.isPrivate) {
tempBoards.add(homeboard);
}
for (var key in doc.data.keys) {
print('Key: $key, Value: ${doc.data[key]}');
}
print('----------');
}
}
for (var doc in results[2].rows) {
final baseData = boardsMap[doc.$id];
if (baseData != null) {
tempBoards.add(GymBoard(
gymId: doc.data['gymId'],
boardModerators: doc.data['boardModerators'],
boardId: doc.$id,
boardName: baseData['boardName'],
)
..boardAngle = baseData['boardAngle'] ?? 0
..dateCreated = DateTime.parse(doc.$createdAt)
..dateSetUpdated = DateTime.parse(doc.$updatedAt)
);
for (var key in doc.data.keys) {
print('Key: $key, Value: ${doc.data[key]}');
}
print('----------');
}
}
Appwrite SDK 20.3.0, Database self hosted on 1.8.0, Flutter version 3.38.5
heres a screenshot of the columns for the table that I am pulling data from in the results from above
Recommended threads
- Function global variables
when i create a top-level global variable in go or bun how will it behave? is the heap getting renewed on every execution or could i do some kind of temp. cachi...
- sh: vite: Permission denied
When installing the vue starter template as site and then adding DaisyUI, i get the error `sh: vite: Permission denied`. I also got this issue (with a fresh tem...
- Appwrite Auth & Function don't reveal cl...
When I execute a function or sign in with my Flutter app, Appwrite does not show my real IP: instead, it seems that Appwrite shows Fastly CDN IP address.