@override Object toJson() { return { if (mode.isNotDefault) 'mode': mode.toJson(), if (dynamicThreshold != null) 'dynamicThreshold': encodeDouble(dynamicThreshold), }; }