@dryv/flutter-api-bridgev0.1.0
A Dart/Flutter package over flutter_api_bridge with typed features, endpoints and models.
dryv pack add @dryv/flutter-api-bridge{#- "yes" when an earlier operation already introduced the operation's group. -#}
{%- macro group_seen(operation, position) -%}
{%- for other in operations -%}
{%- if loop.index < position and other.group is not none and operation.group is not none and other.group.id == operation.group.id -%}yes{%- endif -%}
{%- endfor -%}
{%- endmacro -%}
import 'package:flutter_api_bridge/flutter_api_bridge.dart';
{%- for dependency in file.dependencies %}{% if dependency.symbol and dependency.template == 'feature' %}
import '{{ dependency.path.relative }}';
{%- endif %}{% endfor %}
/// The generated API client: one typed feature client per group, sharing one connection.
class {{ application.name.pascal }}Client {
{{ application.name.pascal }}Client(ApiConnection connection)
: _connection = connection;
final ApiConnection _connection;
{%- for operation in operations %}
{%- if operation.group is not none and group_seen(operation, loop.index) == '' %}
/// {{ operation.group.name.title }} operations.
late final {{ operation.group.name.camel }} = {{ operation.group.name.pascal }}Feature(_connection);
{%- endif %}
{%- endfor %}
}