Skip to content
Back

Document List not showing up in Flutter app (connection issue ig)

  • 0
  • Flutter
  • Cloud
Kannan
29 Mar, 2025, 22:04

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.

TL;DR
Developers are experiencing issues with a Flutter app not displaying the Document List due to a connection problem. The error "ClientException with SocketException: Connection timed out" was identified when attempting to fetch documents from Appwrite. Progress was made by catching exceptions and updating the code accordingly. However, the issue persists despite efforts to resolve it. A potential cause was cited as a change in the plan status, but the problem remains unresolved.
Kannan
29 Mar, 2025, 22:06

@D5 hi

D5
29 Mar, 2025, 22:09

Hello! What's your code?

Kannan
29 Mar, 2025, 22:10

pretty straight forward

TypeScript
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']}');
    }
Kannan
29 Mar, 2025, 22:12

this is the output:

TypeScript
I/flutter (14046): ------ GET ORGANAIZATION LIST ------
I/flutter (14046): Fetching documents...
I/ViewRootImpl@360ef36[MainActivity](14046): onDisplayChanged oldDisplayState=2 newDisplayState=2
Kannan
29 Mar, 2025, 22:12

ill send the full ()

Kannan
29 Mar, 2025, 22:12
TypeScript
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;
  }
Kannan
29 Mar, 2025, 22:13

after Fetching documents prints , it just dies

Kannan
29 Mar, 2025, 22:13

as in no response

Kannan
29 Mar, 2025, 22:15

i double checked all the ID's

D5
29 Mar, 2025, 22:15

You have a catch?

D5
29 Mar, 2025, 22:15

After the try?

D5
29 Mar, 2025, 22:15

If not, add it and print the error

Kannan
29 Mar, 2025, 22:15

no , now that u pointed it out , mb , 1 sec

Kannan
29 Mar, 2025, 22:17

updated code:

TypeScript
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:

TypeScript
I/flutter (14046): ------ GET ORGANAIZATION LIST ------
I/flutter (14046): Fetching documents...
I/ViewRootImpl@360ef36[MainActivity](14046): onDisplayChanged oldDisplayState=2 newDisplayState=2
Kannan
29 Mar, 2025, 22:18

if ur wondering to keep this simple , i made the frontend simple , so if i click the button it trigggers the getOrgs()

TypeScript
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'),
          ),
        ),
      ),
    );
  }
}
Kannan
29 Mar, 2025, 22:33

okay so progress , i got an error : after a while

TypeScript
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?#
D5
29 Mar, 2025, 22:41

Just catch e. Remove the on AppwriteException

Kannan
29 Mar, 2025, 22:46

it has to be this thing

Kannan
29 Mar, 2025, 22:47

🤯 IT WORKEDDDDD

Kannan
29 Mar, 2025, 22:47

whatttt

Kannan
29 Mar, 2025, 22:47
TypeScript
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
Kannan
29 Mar, 2025, 22:48

whatttt, so is this badd, AppwriteException? a bug in the appwrite sdk?

D5
29 Mar, 2025, 22:54

Uh? I didn't want to solve it with that. Just get the error 😅

D5
29 Mar, 2025, 22:54

Are you paying for the pro plan?

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more