Asterisk suffix (*) on any Element data type (analyzer >= 0.40.0)

802 Views Asked by At

After upgrading to 0.40.0 I started getting an awkward asterisk suffix sign after any type.

Example...

print(elementInstance.type.toString());

I used to get Stream<bool> now I'm getting Stream<bool*>*

Do I miss any analyzer settings or dart formatting?

Thanks in advance.

2

There are 2 best solutions below

0
On

We can simply use Element's new method getDisplayString() which has a bool parameter withNullability.

Based on the @Andrey Gritsay's comment I conducted a quick debug into the analyzer package and found it.

0
On

It says just that a variable could be either nullable or non nullable because such behaviour was before NNBD (Dart v.2.12) where you have to explicitly mark a variable with question mark if it is nullable

Check out this article https://dart.dev/null-safety