Skip to content

Commit

Permalink
SNRGY-3272 fix favorite status not waiting for device call
Browse files Browse the repository at this point in the history
  • Loading branch information
zsco committed May 6, 2024
1 parent 6e8cb8f commit 6b3fa45
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/services/devices.dart
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ class DevicesService {
l.length, (index) => DeviceInstance.fromJson(l[index]));
_logger.d("Getting devices from remote DB took ${DateTime.now().difference(
start)}");
devices.forEach((element) async {element.favorite = await element.isFavorite();});


List<Future> futures = [];
devices.forEach((element) { futures.add(element.isFavorite().then((value) => element.favorite = value));});
await Future.wait(futures);

if (isar != null && collection != null) {
await isar!.writeTxn(() async {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 0.0.312+312
version: 0.0.313+313


environment:
Expand Down

0 comments on commit 6b3fa45

Please sign in to comment.