Josh Burton f48325ac45 [dart-dio] Fixes issues with DateTime import and form date paramaterToString function (#4929)
- due to the addition of the timemachine library, models were importing ‘DateTime’ when using the core library, which is not a valid import.

- the parameterToString function was copied from the dart2 generator and had some errors when some enums were classes.
2020-01-17 15:35:38 +08:00

14 lines
364 B
Dart

import 'dart:convert';
import 'package:built_value/serializer.dart';
/// Format the given parameter object into string.
String parameterToString(Serializers serializers, dynamic value) {
if (value == null) {
return '';
} else if (value is String || value is num) {
return value.toString();
} else {
return json.encode(serializers.serialize(value));
}
}