Я на самом деле разрабатываю мобильное приложение с помощью Flutter, и я хотел бы отправить ему электронное письмо. Для этого я попытался использовать плагин Mailer со следующим кодом:
import 'package:flutter/material.dart';
import 'package:mailer2/mailer.dart';
main() {
var options = new GmailSmtpOptions()
..username = 'mer*******@gmail.com'
..password = '*******';
var emailTransport = new SmtpTransport(options);
// Create our mail/envelope.
var envelope = new Envelope()
..from = 'mer*******@gmail.com'
..recipients.add('*******@*****.fr')
..subject = 'Testing the Dart Mailer library'
..text = 'This is a cool email message. Whats up? 語'
..html = '<h1>Test</h1><p>Hey!</p>';
// Email it.
emailTransport.send(envelope)
.then((envelope) => print('Email sent!'))
.catchError((e) => print('Error occurred: $e'));
}
Однако у меня есть следующая ошибка:
I/flutter (22531): Error occurred: type '_AsBroadcastStream<dynamic>' is not a subtype of type 'Stream<Envelope>' where
I/flutter (22531): _AsBroadcastStream is from dart:async
I/flutter (22531): Stream is from dart:async
I/flutter (22531): Envelope is from package:mailer/mailer.dart
Может ли кто-нибудь мне помочь? Заранее спасибо!