11part of {{ language .params .packageName }};
2-
3- {% import " flutter/base/macros.twig" as macros %}
2+ {% macro parameter(parameter ) %}{% if parameter .required %}required {{ parameter .type | typeName }}{% else %}{{ parameter .type | typeName }}?{% endif %} {{ parameter .name | caseCamel | escapeKeyword }}{% endmacro %}
3+ {% macro method_parameters(parameters , consumes ) %}
4+ {% if parameters .all | length > 0 %}{{ ' {' }}{% for parameter in parameters .all %}{{ _self.parameter (parameter ) }}{% if not loop .last %}, {% endif %}{% endfor %}{% if ' multipart/form-data' in consumes %}, Function(UploadProgress)? onProgress{% endif %}{{ ' }' }}{% endif %}
5+ {% endmacro %}
46
57{%if service .description %}
68{{ service .description | dartComment}}
@@ -15,17 +17,17 @@ class {{ service.name | caseUcfirst }} extends Service {
1517{{ method .description | dartComment }}
1618 ///
1719{% endif %}
18- {% if method .type == ' webAuth' %}Future{% elseif method .type == ' location' %} Future<Uint8List > {% else %} {% if method .responseModel and method .responseModel != ' any' %}Future<models .{{method .responseModel | caseUcfirst }}>{% else %}Future{% endif %}{% endif %} {{ method .name | caseCamel }}({{ macros .method_parameters (method .parameters , method .consumes ) }}) async {
20+ {% if method .type == ' webAuth' %}Future{% elseif method .type == ' location' %} Future<Uint8List > {% else %} {% if method .responseModel and method .responseModel != ' any' %}Future<models .{{method .responseModel | caseUcfirst }}>{% else %}Future{% endif %}{% endif %} {{ method .name | caseCamel }}({{ _self .method_parameters (method .parameters , method .consumes ) }}) async {
1921 {% if method .parameters .path | length > 0 %}final{% else %}const{% endif %} String path = '{{ method .path }}'{% for parameter in method .parameters .path %}.replaceAll('{{ ' {' }}{{ parameter .name | caseCamel }}{{ ' }' }}', {{ parameter .name | caseCamel | escapeKeyword }}){% endfor %};
2022
2123{% if ' multipart/form-data' in method .consumes %}
22- {{ include (' flutter/base/file.twig' ) }}
24+ {{ include (' flutter/base/requests/ file.twig' ) }}
2325{% elseif method .type == ' webAuth' %}
24- {{ include (' flutter/base/oauth.twig' ) }}
26+ {{ include (' flutter/base/requests/ oauth.twig' ) }}
2527{% elseif method .type == ' location' %}
26- {{ include (' flutter/base/location.twig' ) }}
28+ {{ include (' flutter/base/requests/ location.twig' ) }}
2729{% else %}
28- {{ include (' flutter/base/api.twig' ) }}
30+ {{ include (' flutter/base/requests/ api.twig' ) }}
2931{% endif %}
3032
3133 }
0 commit comments