Skip to content

Commit 3fc685b

Browse files
author
Sergey Khomushin
committed
Fix examples
1 parent 3971460 commit 3fc685b

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ try {
4545
'<YOUR_SERVICE_ID>',
4646
'<YOUR_TEMPLATE_ID>',
4747
templateParams,
48-
'<YOUR_PUBLIC_KEY>',
48+
const Options(
49+
publicKey: '<YOUR_PUBLIC_KEY>',
50+
privateKey: '<YOUR_PRIVATE_KEY>',
51+
),
4952
);
5053
print('SUCCESS!');
5154
} catch (error) {
@@ -58,7 +61,10 @@ try {
5861
import package:emailjs/emailjs.dart
5962
6063
// set Public Key as global settings
61-
EmailJS.init('<YOUR_PUBLIC_KEY>');
64+
EmailJS.init(const Options(
65+
publicKey: '<YOUR_PUBLIC_KEY>',
66+
privateKey: '<YOUR_PRIVATE_KEY>',
67+
));
6268
6369
try {
6470
// send the email without dynamic variables

example/lib/main.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,16 @@ class _HomePageState extends State<HomePage> {
3838
'user_email': '[email protected]',
3939
'message': 'Hi',
4040
},
41-
'<YOUR_PUBLIC_KEY>',
41+
const Options(
42+
publicKey: '<YOUR_PUBLIC_KEY>',
43+
privateKey: '<YOUR_PRIVATE_KEY>',
44+
),
4245
);
4346
print('SUCCESS!');
4447
} catch (error) {
48+
if (error is EmailJSResponseStatus) {
49+
print('ERROR... ${error.status}: ${error.text}')
50+
}
4551
print(error.toString());
4652
}
4753
}

0 commit comments

Comments
 (0)