You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
The Dart generator adds unnecessary null handling code for non-nullable primitive responses, making the return type nullable when it shouldn't be.
Is there an option to prevent this behavior?
Current behavior:
Future<bool?> hasUnreadNotification() async {
final response =awaithasUnreadNotificationWithHttpInfo();
if (response.statusCode >=HttpStatus.badRequest) {
throwApiException(response.statusCode, await_decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"// FormatException when trying to decode an empty string.if (response.body.isNotEmpty && response.statusCode !=HttpStatus.noContent) {
returnawait apiClient.deserializeAsync(await_decodeBodyBytes(response), 'bool',) asbool;
}
returnnull;
}
Expected behavior:
Future<bool> hasUnreadNotification() async {
final response =awaithasUnreadNotificationWithHttpInfo();
if (response.statusCode >=HttpStatus.badRequest) {
throwApiException(response.statusCode, await_decodeBodyBytes(response));
}
returnawait apiClient.deserializeAsync(await_decodeBodyBytes(response), 'bool',) asbool;
}
Additional context:
The backend endpoint always returns a non-nullable boolean, but the generator adds unnecessary null handling code and makes the return type nullable.
The text was updated successfully, but these errors were encountered:
Description:
The Dart generator adds unnecessary null handling code for non-nullable primitive responses, making the return type nullable when it shouldn't be.
Is there an option to prevent this behavior?
Current behavior:
Expected behavior:
Backend endpoint:
Version:
Additional context:
The backend endpoint always returns a non-nullable boolean, but the generator adds unnecessary null handling code and makes the return type nullable.
The text was updated successfully, but these errors were encountered: