title: How to show success message and catch error during flutter firestore data update
body: <p>I have this function</p>
  <pre><code>Future updateMember(Member member) async {
    final User? user = Auth().currentUser;
    final docMember =
        FirebaseFirestore.instance.collection('users').doc(user?.uid);
    member.id = docMember.id;
  
    final json = member.toJson();
    final response = await docMember
        .update(json)
        .then((value) =&gt; {print(&quot;done&quot;)})
        .catchError((e) =&gt; (e));
  
    return response;
  }
  </code></pre>
  <p>Then I want to catch the error here and success message here</p>
  <pre><code>  final response = updateMember(member);
                if (response.then((value) =&gt; 'done') == true) {
                  ScaffoldMessenger.of(context).showSnackBar(
                    const SnackBar(
                      content: Text('success'),
                      backgroundColor: Colors.green,
                    ),
                  );
                } else {
                  ScaffoldMessenger.of(context).showSnackBar(
                    const SnackBar(
                      content: Text(catchError(onError)),
                      backgroundColor: Colors.red,
                    ),
                  );
                }
  </code></pre>
  <p>Please I need help on how I can implement this</p>