flutter_gen icon indicating copy to clipboard operation
flutter_gen copied to clipboard

Add support for deferred components

Open ianmaciel opened this issue 1 year ago • 4 comments

What does this change?

This PR include support for Flutter Deferred Components.

Deferred components allow developers to the app into multiple apk to reduce its size. This can be used to optimize the initial download and download components only on necessary but it is also mandatory for apk with more than 200MB.

This library initially looks for assets listed on flutter.assets of pubspec.yaml, with this change the library will continue looking for the assets lists under flutter.assets but will merge with the list of assets included on flutter.deferred-components.$. This will be merged in a single list.

Ideally in the future assets should have different classname, so users will easily know when dealing with deferred components. This wasn't implemented at this moment because it would requeire a significative changes.

Fixes #577 🎯

Type of change

Please delete options that are not relevant.

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [x] This change requires a documentation update

Checklist:

Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • [x] Make sure to open a GitHub issue as a bug/feature request before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
    • [ ] Ensure the tests (melos run test)
    • [ ] Ensure the analyzer and formatter pass (melos run format to automatically apply formatting)
  • [ ] Appropriate docs were updated (if necessary)

ianmaciel avatar Sep 17 '24 00:09 ianmaciel

Also we need a test to make sure it works well

AlexV525 avatar Sep 17 '24 03:09 AlexV525

Hi @AlexV525, I'm sorry about the late response. I couldn't get back to this before.

I pushed fixups for this pr, if this is okay please let me know so can rebase squashing those fixups.

ianmaciel avatar Sep 26 '24 20:09 ianmaciel

Changes are good but still missing tests. You don't need to squash them as we'll squash them to commit eventually.

AlexV525 avatar Oct 01 '24 11:10 AlexV525

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 96.52%. Comparing base (d252f15) to head (a688769). Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #576      +/-   ##
==========================================
+ Coverage   96.49%   96.52%   +0.03%     
==========================================
  Files          24       24              
  Lines         914      922       +8     
==========================================
+ Hits          882      890       +8     
  Misses         32       32              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Nov 20 '24 05:11 codecov[bot]