0

I want to conver the firebase incoming data from object? to Map<String , dynamic>. please help

fetchInitialNotificationData()async{
    emit(NotificationLoading());
    try{

      reference.child("User").orderByKey().onValue.listen((event) { 
       final  userNames =Map<String , dynamic>.from(event.snapshot.value);
       print(userNames);
        });

        List<String> userList = [];
        emit(NotificationContains(userList: userList));
      
      
    }
    catch(e){
      print(e.toString());
    }
  }
1
  • Which object do you want to use as Map? Commented Jan 27, 2022 at 3:38

1 Answer 1

1
querySnapshot.docs
        .map((e) => PurchaseModel.fromJson(e.data() as Map<String, dynamic>));

Try this //

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.