File tree Expand file tree Collapse file tree 5 files changed +21
-11
lines changed Expand file tree Collapse file tree 5 files changed +21
-11
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,10 @@ import 'package:http/http.dart' as http;
6
6
import 'src/models/emailjs_response_status.dart' ;
7
7
import 'src/utils/validate_params.dart' ;
8
8
import 'src/api/send_json.dart' ;
9
- import 'src/types/options.dart' ;
9
+ import 'src/models/options.dart' ;
10
+
11
+ export 'src/models/emailjs_response_status.dart' ;
12
+ export 'src/models/options.dart' ;
10
13
11
14
class EmailJS {
12
15
/// Public Key specified in the [init] method
Original file line number Diff line number Diff line change @@ -14,9 +14,15 @@ Future<EmailJSResponseStatus> sendJSON(
14
14
);
15
15
16
16
if (response.statusCode == 200 ) {
17
- return EmailJSResponseStatus (response.statusCode, response.body);
17
+ return EmailJSResponseStatus (
18
+ status: response.statusCode,
19
+ text: response.body,
20
+ );
18
21
} else {
19
- throw EmailJSResponseStatus (response.statusCode, response.body);
22
+ throw EmailJSResponseStatus (
23
+ status: response.statusCode,
24
+ text: response.body,
25
+ );
20
26
}
21
27
} finally {
22
28
client.close ();
Original file line number Diff line number Diff line change 1
1
/// Response status from EmailJS API
2
2
class EmailJSResponseStatus {
3
- int status = 0 ;
4
- String text = 'Network Error' ;
3
+ /// Response status code
4
+ final int status ;
5
5
6
- EmailJSResponseStatus (int ? status, String ? text) {
7
- this .status = status ?? 0 ;
8
- this .text = text ?? 'Network Error' ;
9
- }
6
+ /// Response text
7
+ final String text;
8
+
9
+ const EmailJSResponseStatus ({
10
+ this .status = 0 ,
11
+ this .text = 'Network Error' ,
12
+ });
10
13
}
File renamed without changes.
Original file line number Diff line number Diff line change @@ -2,8 +2,6 @@ import 'package:flutter_test/flutter_test.dart';
2
2
import 'package:mocktail/mocktail.dart' ;
3
3
import 'package:http/http.dart' as http;
4
4
5
- import 'package:emailjs/src/models/emailjs_response_status.dart' ;
6
- import 'package:emailjs/src/types/options.dart' ;
7
5
import 'package:emailjs/emailjs.dart' ;
8
6
9
7
class MockClient extends Mock implements http.Client {}
You can’t perform that action at this time.
0 commit comments