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;
66import 'src/models/emailjs_response_status.dart' ;
77import 'src/utils/validate_params.dart' ;
88import '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' ;
1013
1114class EmailJS {
1215 /// Public Key specified in the [init] method
Original file line number Diff line number Diff line change @@ -14,9 +14,15 @@ Future<EmailJSResponseStatus> sendJSON(
1414 );
1515
1616 if (response.statusCode == 200 ) {
17- return EmailJSResponseStatus (response.statusCode, response.body);
17+ return EmailJSResponseStatus (
18+ status: response.statusCode,
19+ text: response.body,
20+ );
1821 } else {
19- throw EmailJSResponseStatus (response.statusCode, response.body);
22+ throw EmailJSResponseStatus (
23+ status: response.statusCode,
24+ text: response.body,
25+ );
2026 }
2127 } finally {
2228 client.close ();
Original file line number Diff line number Diff line change 11/// Response status from EmailJS API
22class EmailJSResponseStatus {
3- int status = 0 ;
4- String text = 'Network Error' ;
3+ /// Response status code
4+ final int status ;
55
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+ });
1013}
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';
22import 'package:mocktail/mocktail.dart' ;
33import 'package:http/http.dart' as http;
44
5- import 'package:emailjs/src/models/emailjs_response_status.dart' ;
6- import 'package:emailjs/src/types/options.dart' ;
75import 'package:emailjs/emailjs.dart' ;
86
97class MockClient extends Mock implements http.Client {}
You can’t perform that action at this time.
0 commit comments