• Lau Ching Jun's avatar
    Fixed race condition in PollingDeviceDiscovery. (#145506) · c759c22e
    Lau Ching Jun authored
    There are two issues in the previous implementation:
    1. `_populateDevices` will return the devices from `deviceNotifier` if it had been initialized, assuming that once it's initialized, it has been properly populated. That assumption is not true because calling getters like `onAdded` would initialize `deviceNotifier` without populating it.
    2. `deviceNotifier` instance might be replaced in some cases, causing `onAdded` subscribers to lose any future updates.
    
    To fix (1), this commit added the `isPopulated` field in `deviceNotifier` as a more accurate flag to determine if we need to populate it.
    
    To fix (2), this commit made `deviceNotifier` a final member in `PolingDeviceDiscovery`.
    c759c22e
Name
Last commit
Last update
..
bin Loading commit data...
doc Loading commit data...
gradle Loading commit data...
ide_templates/intellij Loading commit data...
lib Loading commit data...
static Loading commit data...
templates Loading commit data...
test Loading commit data...
tool Loading commit data...
README.md Loading commit data...
analysis_options.yaml Loading commit data...
dart_test.yaml Loading commit data...
pubspec.yaml Loading commit data...