forked from loafle/openapi-generator-original
- 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.
14 lines
364 B
Dart
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));
|
|
}
|
|
} |