Realtime types (e.g. RealtimeHistoryParams
) extending Rest ones (e.g. RestHistoryParams
) can cause problems (crashes)
#241
Labels
bug
Something isn't working. It's clear that this does need to be fixed.
Realtime types (e.g. {{RealtimeHistoryParams}}) extending Rest ones (e.g. {{RestHistoryParams}}) can cause problems (crashes)
Using
{code}
_rest!.channels.get(defaultChannel).history(
ably.RealtimeHistoryParams(
limit: 10,
untilAttach: true,
),
),
{code}
Will crash the app with
Notice that {{RealtimeHistoryParams}} is passed as an argument to a {{RestChannel.history}}. Because in Ably Flutter, {{RealtimeHistoryParams}} is a {{RestHistoryParams}}, the user is allowed to do this. We should stop having {{RealtimeHistoryParams}} being a {{RestHistoryParams}}.
There are other instances of this behaviour, where a realtime class extends a rest class because it shares some code. We should consider cases like this and object oriented programming, and find a solution to it.
The text was updated successfully, but these errors were encountered: