feat: enforce the deferred loading constraint

Open
#26 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
dart, flutter
Domain
tooling

Research direction

Start with the Deferred loading and Enforcing it sections of project_structure.md, then look at how the plugin already reads each app's lib/ imports and pubspec dependencies. The work is two checks: a package-level reachability check over the pubspec graph, and a library-level check over the barrel import graph, both excluding deferred edges. Done means fixtures for one correctly deferred feature and one eagerly imported feature, tests that pass for the first and fail with the eager path named in the error for the second.

Written by the indexing model from the issue text.

Description

feature

Description

A package an app loads deferred must not also be reachable from the app through a non-deferred import path. If it is, deferring it achieves nothing, and the reference points out that this failure is silent: nothing breaks and no analyzer warning fires (Deferred loading in project_structure.md).

The reference already describes how to enforce it, under Enforcing it: mark the deferred edges in the app's import graph, compute the set of packages reachable without crossing one, and check that no deferred target is in that set.

Requirements

  • Find import ... deferred as ... directives in each app's lib/.
  • Package-level check: no deferred target is reachable from the app through the pubspec graph without crossing a deferred edge.
  • Library-level check at subfeature-barrel granularity, using the library import graph. The reference notes the package-level check only catches the coarse case.
  • Error output names the eager path that makes the deferred package reachable.
  • Fixtures and tests cover a correctly deferred feature and one pulled in eagerly by another feature.
  • All CI/CD checks are passing.
  • There is no drop in the test coverage percentage.

Additional Context

Only relevant for web builds and Android deferred components. On an iOS/Android-only app the check has no effect but does no harm.

Dominant language
Dart
Stars
7
Forks
2
Avg merge
9h 59m
Merged PRs (30d)
7

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from VeryGoodOpenSource/vgv-ffca-plugin

All issues in VeryGoodOpenSource/vgv-ffca-plugin

Similar issues

More Dart issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.