parse-community / Parse-SDK-Flutter

The Dart/Flutter SDK for Parse Platform

Home Page:https://parseplatform.org

Repository from Github https://github.comparse-community/Parse-SDK-FlutterRepository from Github https://github.comparse-community/Parse-SDK-Flutter

Compilation error due to `LiveQueryClientEvent` not exhaustively matched

sgehrman opened this issue · comments

Same bug has been there for months. Don't you test basics like compiling without errors?

ERROR: ../../../../.pub-cache/git/Parse-SDK-Flutter-bae912fa2741c9b84bc0e6fec84bbc2b539280e6/packages/dart/lib/src/utils/parse_live_list.dart:535:17: Error: The type 'LiveQueryClientEvent' is not exhaustively matched by the switch cases since it doesn't match 'LiveQueryClientEvent.disconnected'.
ERROR: - 'LiveQueryClientEvent' is from 'package:parse_server_sdk/parse_server_sdk.dart' ('../../../../.pub-cache/git/Parse-SDK-Flutter-bae912fa2741c9b84bc0e6fec84bbc2b539280e6/packages/dart/lib/parse_server_sdk.dart').
ERROR: Try adding a default case or cases that match 'LiveQueryClientEvent.disconnected'.
ERROR: switch (event) {
ERROR: ^

 LiveQuery()
        .client
        .getClientEventStream
        .listen((LiveQueryClientEvent event) {
      _subscriptionQueue.whenComplete(() async {
        // ignore: missing_enum_constant_in_switch
        switch (event) {
          case LiveQueryClientEvent.connected:
            final ParseResponse parseResponse = await queryBuilder.query();
            if (parseResponse.success) {
              super.object = parseResponse.result.first;
            }
            break;
          case LiveQueryClientEvent.userDisconnected:    // < ---- add these, doesn't even compile
          case LiveQueryClientEvent.disconnected:
            break;
        }
      });

Thanks for opening this issue!

@sgehrman If this issue is known for months, could you please post a link to the previously reported issue, so we can close this as a duplicate?

@mbfakourii Do you have any idea why this wasn't picked up by our CI, or how relevant this issue is to the SDK? This seems like a lint error where the switch blocks lacks a case. I'm unsure whether this is just a fail of @sgehrman's custom lint rule or whether this is something that should fail also in our CI.

@sgehrman
You are doing the wrong implementation, please read the LiveQuery document.
We use LiveQueryEvent, not LiveQueryClientEvent !

The LiveQueryClientEvent.userDisconnected event is handled inside the package itself and does not need to be implemented by you.

And please ask your issues in template format.

@mtrezza
I think these issues should be closed.

@sgehrman Could you please confirm that the issue is due to your incorrect implementation and this issue here can be closed?

I'm closing this as it does not seem to be a Parse Flutter SDK issue.