Error:
Произошло исключение.
JsonUnsupportedObjectError (Converting object to an encodable object failed: Closure: () => Map<dynamic, dynamic>)
Code:
Map toJson() => {
"UnigTime": {
"hour": _timerHourCurrentSliderValue,
"minute": _timerMinuteCurrentSliderValue.toInt()
}
};
final jsonAllTime = jsonEncode(toJson);
Server().async(jsonAllTime);
CodePudding user response:
You are trying to convert a Function
. instead of this line
final jsonAllTime = jsonEncode(toJson);
you should have this line where it returns the Map
final jsonAllTime = jsonEncode(toJson());