Skip to content

Windows: LiveQuery not working since 9.0.0 #1042

@d-ukhanov

Description

@d-ukhanov

New Issue Checklist

Issue Description

Starting with parse_server_sdk_flutter 9.0.0 , LiveQuery subscriptions no longer work in applications compiled for Windows.
Among the console output, the only relevant message is:
LiveQueryReconnectingController: ParseConnectivityResult.none.
Rolling back to version 8.0.0 restores LiveQuery functionality.

Steps to reproduce

  1. Create a Flutter app using parse_server_sdk_flutter: 9.0.0.
  2. Connect it to a running Parse Server instance.
  3. Run the app on Windows.
  4. Attempt to subscribe to a LiveQuery.

Actual Outcome

LiveQuery does not connect or receive any updates. The console logs: LiveQueryReconnectingController: ParseConnectivityResult.none

Expected Outcome

LiveQuery should connect successfully and receive updates, as it does with SDK version 8.0.0.

Environment

Parse Flutter SDK

  • SDK version: 9.0.0
  • Flutter version: 3.32.4
  • Dart version: 3.8.1
  • Operating system version: Windows 10

Server

  • Parse Server version: 7.5.2

Root Cause

The issue is related to recent changes in Connectivity handling (relevant PR)
and a bug in the connectivity_plus package (related issue).

On Windows (and, as indicated by the connectivity_plus issue, also on macOS),
Connectivity().checkConnectivity() returns ConnectivityResult.ethernet instead of ConnectivityResult.wifi.
Previously, parse_server_sdk_flutter had a fallback condition:

default: return sdk.ParseConnectivityResult.wifi;

which masked this behavior, so the issue did not surface in older versions.

Workaround

Provide a custom implementation of ParseConnectivityProvider when calling Parse().initialize, for example:

class CustomParseConnectivityProvider extends ParseConnectivityProvider { @override Future<ParseConnectivityResult> checkConnectivity() async { final List<ConnectivityResult> list = await Connectivity().checkConnectivity(); if ([ConnectivityResult.wifi, ConnectivityResult.ethernet] .any(list.contains)) { return ParseConnectivityResult.wifi; } else if (list.contains(ConnectivityResult.mobile)) { return ParseConnectivityResult.mobile; } else { return ParseConnectivityResult.none; } } @override Stream<ParseConnectivityResult> get connectivityStream { return Connectivity().onConnectivityChanged.map( (List<ConnectivityResult> event) { if ([ConnectivityResult.wifi, ConnectivityResult.ethernet] .any(event.contains)) { return ParseConnectivityResult.wifi; } else if (event.contains(ConnectivityResult.mobile)) { return ParseConnectivityResult.mobile; } else { return ParseConnectivityResult.none; } }, ); } }

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions