cedvdb / phone_form_field

Flutter phone number input
https://pub.dev/packages/phone_form_field
MIT License
72 stars 100 forks source link

feat: add option to enable or disable asset flag preload #237

Closed kleytonstn closed 6 months ago

kleytonstn commented 7 months ago

This change offers the option of lazy loading for scenarios where upfront asset download isn't necessary or detrimental to the performance of the page.

cedvdb commented 7 months ago

Can you elaborate on when and how this is detrimental ?

kleytonstn commented 7 months ago

Can you elaborate on when and how this is detrimental ?

Use case: a web page where other requests are being made at the same time, loading all the assets concurrently is not good for performance, it's better to let the developer decide the approach.

cedvdb commented 7 months ago

Use case: a web page where other requests are being made at the same time, loading all the assets concurrently is not good for performance, it's better to let the developer decide the approach.

  1. This seems like a good addition for people not using HTTP 2.
  2. It would be better if this was added to the CountrySelector library as it would benefit there as well.
  3. Tests are missing, since this adds to the public api, tests are needed. It's a bit unclear how this can be achieved since the preload method is static. Maybe by checking if any superfluous request is made.
cedvdb commented 6 months ago

Flags are now disabled by default, Use PhoneFormField.preloadFlags() to preload