It was initially working now i am not even getting any response nor output nor any error msg , but i believe it has something to do with when i created a pro plan using the free credits, but i made it free and its still not being used.
@D5 hi
Hello! What's your code?
pretty straight forward
final documents = await databases.listDocuments(
databaseId: '67e640bd00005fc192ff',
collectionId: '67e640ff002c144a4161',
);
for (Document doc in documents.documents) {
debugPrint('\n-- Org --');
debugPrint('Org: ${doc.data['orgName']}');
debugPrint('Phone: ${doc.data['phoneNumbers']}');
}
this is the output:
I/flutter (14046): ------ GET ORGANAIZATION LIST ------
I/flutter (14046): Fetching documents...
I/ViewRootImpl@360ef36[MainActivity](14046): onDisplayChanged oldDisplayState=2 newDisplayState=2
ill send the full ()
Future<void> getOrgs() async {
debugPrint('------ GET ORGANAIZATION LIST ------');
isLoading.value = true;
// Fetch organizations
try {
debugPrint('Fetching documents...');
final documents = await databases.listDocuments(
databaseId: orgsDatabaseId,
collectionId: orgsCollectionId,
);
debugPrint('------ GET ORGANAIZATION LIST : Request DOC Length: ${documents.documents.length}------');
debugPrint('Orgs: ${documents.documents.length}');
for (Document doc in documents.documents) {
debugPrint('\n-- Org --');
debugPrint('Org: ${doc.data['orgName']}');
debugPrint('Phone: ${doc.data['phoneNumbers']}');
}
} on AppwriteException catch (e) {
isLoading.value = false;
Get.snackbar('Error', e.message ?? 'Something went wrong');
debugPrint('Error: ${e.message}');
}
isLoading.value = false;
}
after Fetching documents prints , it just dies
as in no response
i double checked all the ID's
You have a catch?
After the try?
If not, add it and print the error
no , now that u pointed it out , mb , 1 sec
updated code:
Future<void> getOrgs() async {
debugPrint('------ GET ORGANAIZATION LIST ------');
isLoading.value = true;
// Fetch organizations
try {
debugPrint('Fetching documents...');
final documents = await databases.listDocuments(
databaseId: orgsDatabaseId,
collectionId: orgsCollectionId,
);
debugPrint('------ GET ORGANAIZATION LIST : Request DOC Length: ${documents.documents.length}------');
debugPrint('Orgs: ${documents.documents.length}');
for (Document doc in documents.documents) {
debugPrint('\n-- Org --');
debugPrint('Org: ${doc.data['orgName']}');
debugPrint('Phone: ${doc.data['phoneNumbers']}');
}
} on AppwriteException catch (e) {
isLoading.value = false;
Get.snackbar('Error', e.message ?? 'Something went wrong');
debugPrint('Error: ${e.message}');
} catch(e){
debugPrint('Error: $e');
}
isLoading.value = false;
}
but the output remains the same:
I/flutter (14046): ------ GET ORGANAIZATION LIST ------
I/flutter (14046): Fetching documents...
I/ViewRootImpl@360ef36[MainActivity](14046): onDisplayChanged oldDisplayState=2 newDisplayState=2
if ur wondering to keep this simple , i made the frontend simple , so if i click the button it trigggers the getOrgs()
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return GetMaterialApp(
debugShowCheckedModeBanner: false,
theme: lightTheme,
themeMode: ThemeMode.light,
// getPages: getPages,
// initialRoute: '/organization',
home: Scaffold(
body: Center(
child: ElevatedButton(
onPressed: () {
OrganizationController orgController = Get.put(
OrganizationController(),
);
orgController.getOrgs();
},
child: const Text('Genereate LIST'),
),
),
),
);
}
}
okay so progress , i got an error : after a while
Error: ClientException with SocketException: Connection timed out (OS Error: Connection timed out, errno = 110), address = cloud.appwrite.io, port = 49602, uri=https://cloud.appwrite.io/v1/databases/67e640bd00005fc192ff/collections/67e640ff002c144a4161/documents?#
Just catch e. Remove the on AppwriteException
it has to be this thing
🤯 IT WORKEDDDDD
whatttt
I/flutter ( 5223): ------ GET ORGANAIZATION LIST ------
I/flutter ( 5223): Fetching documents...
D/EGL_emulation( 5223): app_time_stats: avg=787.00ms min=73.19ms max=1500.82ms count=2
I/flutter ( 5223): ------ GET ORGANAIZATION LIST : Request DOC Length: 2------
I/flutter ( 5223): Orgs: 2
I/flutter ( 5223):
I/flutter ( 5223): -- Org --
I/flutter ( 5223): Org: Tellus
I/flutter ( 5223): Phone: 1234
I/flutter ( 5223):
I/flutter ( 5223): -- Org --
I/flutter ( 5223): Org: org2 test
I/flutter ( 5223): Phone: 123
whatttt, so is this badd, AppwriteException? a bug in the appwrite sdk?
Uh? I didn't want to solve it with that. Just get the error 😅
Are you paying for the pro plan?
Recommended threads
- unlike any other provider, your sites DN...
your nameservers dont work with a funny little CNAME error, which is a weird bug but thats what you get when you try to be the kitchen sink, funny errors.
- Weird Table Causes Console to break
I dont even know how this even happened looks like the $createdAt and , $id got switched? <@831428608895615056>
- I recently switched to TablesDb. When li...
olddb.list_documents( queries =[ Query.order_desc("timestamp"), Query.equal("isPosted",[False]) ] ) Above works fine and reruns documents But below don't return...