Quellcode durchsuchen

Update Services.dart

es un poco mas claro que tipo de error se obtiene
Oniel Mendez vor 4 Jahren
Ursprung
Commit
e2e0e8e9e2
1 geänderte Dateien mit 10 neuen und 10 gelöschten Zeilen
  1. 10
    10
      fast_med_flutter/lib/widgets/DataTableMySqlDemo/Services.dart

+ 10
- 10
fast_med_flutter/lib/widgets/DataTableMySqlDemo/Services.dart Datei anzeigen

@@ -15,22 +15,22 @@ class Services {
15 15
       var map = Map<String, dynamic>();
16 16
       map['action'] = _GET_ALL;
17 17
       //print('antes');
18
-      // final response = await http.get(URL_GET_ALL);
18
+      final response = await http.get(URL_GET_ALL);
19 19
       // print('despues');
20 20
       // print('getOficinas Response: ${response.body}');
21
-      // if (200 == response.statusCode) {
22
-      //   List<Oficina> list = parseResponse(response.body);
23
-      final response = '[{"id":"1","name":"test1"},{"id":"2","name":"test2"},{"id":"3","name":"test3"}]';
24
-      //print('despues');
25
-      //print('getOficinas Response: $response');
26
-      if (200 == 200) {
27
-        List<Oficina> list = parseResponse(response);
21
+      if (200 == response.statusCode) {
22
+        List<Oficina> list = parseResponse(response.body);
23
+
28 24
         return list;
29 25
       } else {
30
-        return List<Oficina>();
26
+        final response = '[{"id":"1","name":"no"},{"id":"2","name":"respondio"},{"id":"3","name":"code: 200"}]';
27
+        List<Oficina> list = parseResponse(response);
28
+        return list; // return an empty list on exception/error
31 29
       }
32 30
     } catch (e) {
33
-      return List<Oficina>(); // return an empty list on exception/error
31
+      final response = '[{"id":"1","name":"este"},{"id":"2","name":"es el"},{"id":"3","name":"catch(e)"}]';
32
+      List<Oficina> list = parseResponse(response);
33
+      return list; // return an empty list on exception/error
34 34
     }
35 35
   }
36 36