0

Using the google apis flutter package, I get back the email message object. For example, snippet is a property of this object. It returns a short plaintext of the email message. I would like to parse the email to return a plaintext. How do I parse the email message?

final list = await gmailApi.users.messages.list("me", maxResults: 10, q:"subject:receipt",);
    for (var message in list.messages!) {
      final m = await gmailApi.users.messages
          .get(_currentUser!.id, message.id ?? "", format: "full"); 

      final decoded = base64Url.decode(m.payload?.body?.data ?? "");
      utf8.decode(decoded); // supposed to return plaintext (like m.snippet does) not html
}
Alan Karanja
  • 51
  • 1
  • 3

0 Answers0