Real-Time Database listener not called with DateTime reflection field present

Hi,

need some help with custom classes and real-time database functionality of Backendless. Following flutter sdk documentation and official information (https://backendless.com/how-to-use-custom-classes-in-flutter-sdk/) wrote my simple reflection class:

@reflector
class Show {
  String objectId;
  String title;
  DateTime updated;
}

and registered event listener using:

EventHandler<Show> eventEventHandler = Backendless.data.withClass<Show>().rt();
eventEventHandler.addUpdateListener((response) {
          print("changed ${response.toString()}");
        }, onError: onErrorFunction);

now if I change title data using console or code my listener function is not called. Don’t see any errors, database works fine. However, it works as expected if I comment DateTime line:

//DateTime updated;

Doesn’t matter if it’s updated/created default field or my own DateTime database field. Any DateTime field in any class causes this issue. Using map instead of custom class gives expected results.

Build runners seems to work anytime:

[INFO] Build:Succeeded after 9.7s with 1 outputs (1 actions)

I’m using latest:

backendless_sdk: ^1.1.3
build_runner: ^1.8.0

Please help, I’m stuck. Just started using flutter (and Backendless), am I missing something or it is a bug?

regards,
Peter

Hell @Piotr_U

We are looking into it.

Hi @Piotr_U

I’ve reproduced the issue and created the internal ticket BKNDLSS-20799. We will notify you when the issue will be fixed.

Best Regards,
Maksym

Hi @Piotr_U

The issue is fixed in the version 1.1.4 of the Flutter SDK. Please update the dependency in your pubspec.yaml.

Best Regards,
Maksym

Hi,

thanks for quick response and fix. Great support! Update seems to work now but create listener does not. Could You please check and correct this too? I suppose simple copy/paste will do the job :wink:

Peter

Note: I haven’t check bulk create/update methods…

Hi @Piotr_U

Create listener works fine for me. I used the following code:

EventHandler<Show> eventEventHandler = Backendless.data.withClass<Show>().rt();
eventEventHandler.addCreateListener((response) {
  print("Created: ${response.toString()}");
});

After that I created the new Show table entry 1) from Console; 2) from SDK; and got the next output for both cases:

I/RTClient( 6152): Got result for subscription 115D7BAB-76DF-D656-FF4E-5F077D36D100
I/flutter ( 6152): Created: 'Show' custom class:
I/flutter ( 6152): foo: bar, created: 2020-03-16 16:38:17.000, updated: null

Can you please provide your steps to reproduce the issue?

Best Regards,
Maksym

Hi,

I can confirm that it’s working now. Maybe there was something wrong with my testing, sorry. Let’s assume it’s fixed, will do more tests and let You know if something goes wrong.

Again, thanks for Your time.

Peter U.

Maybe there was invalid cache.
Glad to hear it’s working now! Happy coding with Backendless :slight_smile:

Best Regards,
Maksym