openApiDateParameterToString function

String openApiDateParameterToString(
  1. dynamic value, [
  2. bool encode = true
])

Convert a Date to a string parameter. A {path} parameter requires encoding, whereas a Query parameter doesn't. To ensure a non-breaking API, we use encode to default true.

Implementation

String openApiDateParameterToString(dynamic value, [bool encode = true]) {
  if (encode) {
    return Uri.encodeComponent((value as DateTime).toDateString());
  } else {
    return (value as DateTime).toDateString();
  }
}