rollbar / rollbar-flutter

Rollbar for Dart and Flutter
https://docs.rollbar.com/docs/flutter
MIT License
21 stars 27 forks source link

Unsetting an user causes invalid argument exception #91

Closed rfuerst87 closed 1 year ago

rfuerst87 commented 1 year ago

Calling Rollbar.setUser(null) causes

E/flutter ( 3075): Invalid argument (An Event must have either an error or a message.): event: Instance of 'Event'
E/flutter ( 3075): #0      _Body.from (package:rollbar_dart/src/wrangler/data_wrangler.dart:77:5)
E/flutter ( 3075): #1      _Data.from (package:rollbar_dart/src/wrangler/data_wrangler.dart:42:23)
E/flutter ( 3075): #2      DataWrangler.payload (package:rollbar_dart/src/wrangler/data_wrangler.dart:30:30)
E/flutter ( 3075): #3      _IsolatedNotifier$Isolate.run (package:rollbar_dart/src/notifier/isolated_notifier.dart:82:40)

Since the signature of setUser accepts null values, I assume this is the way to unset and user for example on logout. Is there another way I'm not aware of?

Otherwise I think this needs to be fixed in AsyncNotifier.notify and in IsolateNotifier.run. By the way those two methods seem to duplicate code.

ghost commented 1 year ago

Hey @rfuerst87, Thanks for reporting this issue. I'll check this with the devs and get back to you with an update.

matux commented 1 year ago

@rfuerst87

A new release fixing this issue is out now @ pub.dev:

I appreciate you reporting this issue, and if you find anything else, don't hesitate reporting, we'll do our best to take care of it asap.