_CastError Null check operator used on a null value
daninfpj opened this issue · 5 comments
daninfpj commented
I’m sometimes getting this error when calling translate
.
The problem lies within this function:
Map<dynamic, dynamic>? calculateSubmap(final String translationKey) {
final List<String> translationKeySplitted =
translationKey.split(this.keySeparator!);
translationKeySplitted.removeLast();
Map<dynamic, dynamic>? decodedSubMap = decodedMap;
translationKeySplitted.forEach((listKey) =>
decodedSubMap = (decodedSubMap ?? Map())[listKey] ?? Map());
return decodedSubMap;
}
Specifically, when reaching this line:
Map<dynamic, dynamic>? decodedSubMap = decodedMap;
decodedMap
is null
, which makes the function return null
.
Then, on this line the null check fails:
final Map<dynamic, dynamic> subMap = calculateSubmap(key)!;
Why would decodedMap
be null at that point? In my app, on a following repaint it is no longer null.
ilteoood commented
Can you provide a minimal reproduction example?
tomk9 commented
tomk9 commented
ilteoood commented
Hi guys, I'm in honeymoon right now.
The suggested workaround could be used until I come back, at the end of this week.
ilteoood commented
A fix should have been published with version 0.32.3