@dryv/flutter-appv0.1.0
A Flutter app from views — feature screens, go_router routes, Riverpod state, a connectivity gate, calls through flutter-api-bridge.
dryv pack add @dryv/flutter-appimport 'package:go_router/go_router.dart';
{#- "yes" when an earlier view already introduced the view's feature. -#}
{%- macro feature_seen(view, position) -%}
{%- for other in views %}{% if loop.index < position and other.feature is not none and view.feature is not none and other.feature.id == view.feature.id %}yes{% endif %}{% endfor -%}
{%- endmacro %}
{%- for view in views %}{% if view.feature is not none and feature_seen(view, loop.index) == '' %}
import '../screens/{{ view.feature.name.snake }}/_{{ view.feature.name.snake }}.router.dart';
{%- endif %}{% endfor %}
/// Every generated screen route, grouped by feature.
final appRouter = GoRouter(
initialLocation: '{% for view in views %}{% if loop.first %}/{{ view.group.name.kebab }}/{{ view.name.kebab }}{% endif %}{% endfor %}',
routes: [
{%- for view in views %}{% if view.feature is not none and feature_seen(view, loop.index) == '' %}
...{{ view.feature.name.camel }}RouterRoutes,
{%- endif %}{% endfor %}
],
);