sentry-dart
sentry-dart copied to clipboard
replace `dynamic` to `Object?` whenever possible
we never know if a dynamic is a nullable field, also dynamic disables type checking. should we replace it for better type checking?
@ueman @bruno-garcia
I wonder how that works with JSON (de) serialization, since that historically always has been Map<String,dynamic>. Though I suspect that it works. Other than that I see nothing which should stop us from doing that.
yeah I think at runtime would not change anything, and I also think that we don't call any method directly on dynamic by skipping type check, we always cast before using the dynamic objects anyway.
this would be ideally done with https://github.com/getsentry/sentry-dart/issues/510 so we do a single breaking change in the hints signature, as they are all dynamic
Json decoding returns a Map<String, dynamic> so x.fromJson(Map<String, dynamic>) has to stay that way. A couple of things like extras will have to stay because of that, too. However, there's still a lot of code to improve left.
dynamic decode returns dynamic but can be always cast right, why do we need to keep fromJson as dynamic? I don't see why it'd be a problem.
In favor of https://github.com/getsentry/sentry-dart/issues/510