Hey I love this plugin and I use it In iOS and macOS with no problems, but when I send using WEB I can send but receive this error.
`Performing hot restart...
Waiting for connection from debug service on Chrome...
Restarted application in 766ms.
Error: XMLHttpRequest error.
dart-sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart 906:28 get current
packages/http/src/browser_client.dart 71:22 <fn>
dart-sdk/lib/async/zone.dart 1612:54 runUnary
dart-sdk/lib/async/future_impl.dart 152:18 handleValue
dart-sdk/lib/async/future_impl.dart 704:44 handleValueCallback
dart-sdk/lib/async/future_impl.dart 733:13 _propagateToListeners
dart-sdk/lib/async/future_impl.dart 530:7 [_complete]
dart-sdk/lib/async/stream_pipe.dart 61:11 _cancelAndValue
dart-sdk/lib/async/stream.dart 1219:7 <fn>
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 324:14 _checkAndCall
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 329:39 dcall
dart-sdk/lib/html/dart2js/html_dart2js.dart 37307:58 <fn>
at Object.createErrorWithStack (http://localhost:57621/dart_sdk.js:5044:12)
at Object._rethrow (http://localhost:57621/dart_sdk.js:37476:16)
at async._AsyncCallbackEntry.new.callback (http://localhost:57621/dart_sdk.js:37472:13)
at Object._microtaskLoop (http://localhost:57621/dart_sdk.js:37332:13)
at _startMicrotaskLoop (http://localhost:57621/dart_sdk.js:37338:13)
at http://localhost:57621/dart_sdk.js:33109:9
`
`import 'import.dart';
import 'package:flutter/cupertino.dart';
class EmailSender {
EmailSender({required this.address, required this.message});
final String address;
final String message;
final mailer = Mailer(
'SG.API');
bool sendMail() {
final toAddress = Address('$address');
final fromAddress = Address('my address);
final content = Content('text/plain', '$message');
final subject = 'SUBJECT';
final personalization = Personalization(
[toAddress],
//cc: [fromAddress],
);
bool resultValue = false;
final email = Email(
[personalization],
fromAddress,
subject,
content: [content],
//attachments: [attachments],
);
mailer.send(email).then((result) {
print(result.hashCode);
print('VALUE ${result.isValue}');
//print(result.asValue.value);
print('ERROR ${result.isError}');
result.isError ? print(result.asError!.error) : print('');
if (result.isValue) {
resultValue = true;
} else if (result.isError) {
resultValue = false;
}
});
return resultValue;
}
}
class EmailSenderError extends StatelessWidget {
@override
Widget build(BuildContext context) {
return CupertinoAlertDialog(
title: Text(
'Errore invio email',
),
content: Column(
children: [
Text(
'L\'email non e\' stata inviata a causa di un errore. Verifica l\'inirizzo email o la tua connessione a internet.',
),
],
),
actions: <Widget>[
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: Text(
'Capito',
style: TextStyle(color: CupertinoColors.destructiveRed),
)),
],
);
}
}
`