Advertisement
Guest User

Untitled

a guest
Feb 26th, 2020
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 0.91 KB | None | 0 0
  1. ///
  2.   ///metodo per ottenere la beonlist dell'utente
  3.   ///
  4.   Future createBeonList() async {
  5.     newBeonListUser = [];
  6.     var beonIdFromStorage = [];
  7.     if (window.localStorage.containsKey('beonListiD')) {
  8.       if (window.localStorage['beonListiD'].length > 1) {
  9.         beonIdFromStorage = window.localStorage['beonListiD'].split(',');
  10.       } else {
  11.         beonIdFromStorage.add(window.localStorage['beonListiD']);
  12.       }
  13.       beonIdFromStorage = window.localStorage['beonListiD'].split(',');
  14.     }
  15.     if (beonListIdUser.isEmpty) {
  16.       beonListIdUser = beonIdFromStorage;
  17.     }
  18.     var productInBeon = await db.collection('Product').get();
  19.     beonListIdUser.forEach((beonId) {
  20.       productInBeon.forEach((doc) {
  21.         if (doc.id == beonId) {
  22.           newBeonListUser.add(ProductInBeon(
  23.               doc.id, doc.data()['Name'], doc.data()['PhotoURL']));
  24.         }
  25.       });
  26.     });
  27.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement