Skip to content

Fix type cast using 'whereType' instead of 'as' operator#73

Open
bikcrum wants to merge 1 commit intoDn-a:masterfrom
bikcrum:bugfix/type-casting
Open

Fix type cast using 'whereType' instead of 'as' operator#73
bikcrum wants to merge 1 commit intoDn-a:masterfrom
bikcrum:bugfix/type-casting

Conversation

@bikcrum
Copy link
Copy Markdown

@bikcrum bikcrum commented May 27, 2021

Description

This is the minimal fix for typecasting error caused in null safety mode.

Implementation:

Issue:

<Widget?>[....].where((a) => a != null).toList() as List<Widget>

// causes type 'List<Widget?>' is not a subtype of type 'List<Widget>' in type cast

Fix:

<Widget?>[....].where((a) => a != null).whereType<Widget>().toList()

Effective line numbers: [435-437], [600-620]

Related Issues

#69 #70 #71 #72

@housecode
Copy link
Copy Markdown

is it ready to use at production ?

@definitelyme
Copy link
Copy Markdown

definitelyme commented Oct 23, 2021

@Dn-a can this be merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants