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 1010// ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
1111//.title~
1212
13- import 'package:df_string/df_string.dart' show StringCaseConversionsOnStringX ;
13+ import 'package:df_string/df_string.dart' ;
1414
1515import '../models/field_model/field_model.dart' ;
1616
Original file line number Diff line number Diff line change @@ -33,7 +33,11 @@ abstract mixin class BaseModel {
3333 final encoder = const JsonEncoder .withIndent (' ' );
3434 return encoder.convert (sortedJson ());
3535 } 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+ }
3741 }
3842 }
3943
@@ -59,8 +63,7 @@ abstract mixin class BaseModel {
5963 /// with the keys sorted alphabetically.
6064 Map <String , dynamic > sortedJson ({bool includeNulls = false }) {
6165 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));
6467 final c = {for (var k in b) k: a[k] as dynamic };
6568 return c;
6669 }
@@ -105,8 +108,7 @@ abstract mixin class BaseModel {
105108
106109/// A class that extends [BaseModel] that provides a reference to itself.
107110@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 {
110112 const ThisModel ();
111113}
112114
You can’t perform that action at this time.
0 commit comments