fromJson static method
Implementation
static FMargins fromJson(final dynamic json) {
if (json is List<num>) {
final value = json.map((num e) => e.toDouble()).toList();
return FMargins(
margins: value,
marginsTablet: null,
marginsDesktop: null,
);
}
try {
return FMargins(
margins: (json['m'] as List<dynamic>? ?? [0, 0, 0, 0])
.map((e) => (e as num).toDouble())
.toList(),
marginsTablet: json['t'] != null
? (json['t'] as List<dynamic>)
.map((e) => (e as num).toDouble())
.toList()
: null,
marginsDesktop: json['d'] != null
? (json['d'] as List<dynamic>)
.map((e) => (e as num).toDouble())
.toList()
: null,
);
} catch (e) {
Logger.printError('Error converting FMargins, error: $e');
return const FMargins(
margins: [0, 0, 0, 0],
marginsTablet: null,
marginsDesktop: null,
);
}
}