Is it possible to use ?? operator in this case?

Viewed 55

Suppose situation is the following:

dynamic? _rsomeFunc() {
    final smth = someGetFunction(); //may return null
    return smth != null ? someObject.fromJson(jsonDecode(smth)) : null;
}

is it possible to write it via => in single line function? cause this approach is seems to be not perfect one. I tried it via ?? but it didn't help. Any suggestion?

1 Answers

Thanks for references provided by @jamesdlin. For now (2022/02/10) in Dart 2.16 there is no such opportunity;

Hope they will add it.

Related