Advertisement
mahmud11556

Json_And_Firebase

Sep 30th, 2023
1,567
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 0.82 KB | Source Code | 0 0
  1.  floatingActionButton: FloatingActionButton(onPressed: () async {
  2.         // JSONFile jf = JSONFile("users");
  3.         // List<Object> uk = await jf.read() ;
  4.         // List<User> users = uk as List<User>;
  5.         // users.forEach((element) {print(element.userName);});
  6.  
  7.         FIREBASE fb = FIREBASE("posts");
  8.         List<Object> uk = await fb.fetchData();
  9.         List<Post> posts = uk as List<Post>;
  10.         posts.forEach((element) {print(element.description);});
  11.  
  12.         print("read done\n\n");
  13.  
  14.         JSONFile jfl = JSONFile("posts");
  15.         jfl.write(posts);
  16.  
  17.         print("write done\n\n");
  18.  
  19.  
  20.         JSONFile jf = JSONFile("posts");
  21.         List<Object> uka = await jf.read() ;
  22.         List<Post> postss = uka as List<Post>;
  23.         postss.forEach((element) {print(element.userName);});
  24.  
  25.       },),
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement