File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 10
10
// ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
11
11
//.title~
12
12
13
- import 'package:df_string/df_string.dart' show StringCaseConversionsOnStringX ;
13
+ import 'package:df_string/df_string.dart' ;
14
14
15
15
import '../models/field_model/field_model.dart' ;
16
16
Original file line number Diff line number Diff line change @@ -33,7 +33,11 @@ abstract mixin class BaseModel {
33
33
final encoder = const JsonEncoder .withIndent (' ' );
34
34
return encoder.convert (sortedJson ());
35
35
} catch (e) {
36
- return '{"e": "${e .safeToString ()}"}' ;
36
+ try {
37
+ return '{"e": "$e "}' ;
38
+ } catch (e) {
39
+ return '{"e": "An error occurred but could not be converted to JSON!"}' ;
40
+ }
37
41
}
38
42
}
39
43
@@ -59,8 +63,7 @@ abstract mixin class BaseModel {
59
63
/// with the keys sorted alphabetically.
60
64
Map <String , dynamic > sortedJson ({bool includeNulls = false }) {
61
65
final a = toJson (includeNulls: includeNulls);
62
- final b = a.keys.toList (growable: false )
63
- ..sort ((k1, k2) => k1.compareTo (k2));
66
+ final b = a.keys.toList (growable: false )..sort ((k1, k2) => k1.compareTo (k2));
64
67
final c = {for (var k in b) k: a[k] as dynamic };
65
68
return c;
66
69
}
@@ -105,8 +108,7 @@ abstract mixin class BaseModel {
105
108
106
109
/// A class that extends [BaseModel] that provides a reference to itself.
107
110
@Deprecated ('Use ThisModelMixin instead.' )
108
- abstract class ThisModel <T extends BaseModel > extends BaseModel
109
- with ThisModelMixin {
111
+ abstract class ThisModel <T extends BaseModel > extends BaseModel with ThisModelMixin {
110
112
const ThisModel ();
111
113
}
112
114
You can’t perform that action at this time.
0 commit comments