File tree Expand file tree Collapse file tree
client/lib/features/devices/view_models Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,16 +32,10 @@ class GroupViewModel extends BaseViewModel with ViewModelEventBusMixin {
3232 if (existingIndex == - 1 ) {
3333 _devices = [..._devices, device];
3434 } else {
35- // Replace the existing VM in the list first so the UI can update and
36- // detach any listeners from the old VM. Dispose the old VM later to
37- // avoid `ValueNotifier`-after-dispose errors (widgets may still be
38- // listening during the current frame).
3935 final oldDevice = _devices[existingIndex];
4036 _devices = [..._devices];
4137 _devices[existingIndex] = device;
4238
43- // Defer disposal to the next microtask/frame so widgets have a chance
44- // to remove their listeners from the old ValueNotifiers first.
4539 Future .microtask (() {
4640 if (! oldDevice.isDisposed) {
4741 oldDevice.dispose ();
You can’t perform that action at this time.
0 commit comments