-
Notifications
You must be signed in to change notification settings - Fork 189
fix: strip non-nullable optional params in Dart/Flutter SDKs #1252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,9 +12,6 @@ mixin ClientMixin { | |
| required Map<String, String> headers, | ||
| required Map<String, dynamic> params, | ||
| }) { | ||
|
||
| if (params.isNotEmpty) { | ||
| params.removeWhere((key, value) => value == null); | ||
| } | ||
|
|
||
| http.BaseRequest request = http.Request(method.name(), uri); | ||
| if (headers['content-type'] == 'multipart/form-data') { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,6 +1,10 @@ | ||||||
| {%- macro map_parameter(parameters) -%} | ||||||
| {%- for parameter in parameters ~%} | ||||||
| {% if not parameter.nullable and not parameter.required %} | ||||||
| if ({{ parameter.name | caseCamel | overrideIdentifier }} != null) '{{ parameter.name }}': {{ parameter.name | caseCamel | overrideIdentifier }}{% if parameter.enumValues | length > 0 %}!{% endif %}{% if parameter.enumValues | length > 0 %}.value{% endif %}, | ||||||
|
||||||
| if ({{ parameter.name | caseCamel | overrideIdentifier }} != null) '{{ parameter.name }}': {{ parameter.name | caseCamel | overrideIdentifier }}{% if parameter.enumValues | length > 0 %}!{% endif %}{% if parameter.enumValues | length > 0 %}.value{% endif %}, | |
| if ({{ parameter.name | caseCamel | overrideIdentifier }} != null) '{{ parameter.name }}': {{ parameter.name | caseCamel | overrideIdentifier }}{% if parameter.enumValues | length > 0 %}!.value{% endif %}, |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,9 +12,6 @@ mixin ClientMixin { | |
| required Map<String, String> headers, | ||
| required Map<String, dynamic> params, | ||
| }) { | ||
|
||
| if (params.isNotEmpty) { | ||
| params.removeWhere((key, value) => value == null); | ||
| } | ||
|
|
||
| http.BaseRequest request = http.Request(method.name(), uri); | ||
| if (headers['content-type'] == 'multipart/form-data') { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition
{% if parameter.enumValues | length > 0 %}is duplicated within the same line. Consider simplifying to:if ({{ parameter.name | caseCamel | overrideIdentifier }} != null) '{{ parameter.name }}': {{ parameter.name | caseCamel | overrideIdentifier }}{% if parameter.enumValues | length > 0 %}!.value{% endif %},This improves readability and reduces duplication.