본문 바로가기
Development Solutions/Flutter & Dart

[Flutter][Solved] The argument type 'Widget' can't be assigned to the parameter type 'PreferredSizeWidget?'

by studio ODOC 2023. 7. 28.
반응형

[Flutter][Solved]

The argument type 'Widget' can't be assigned to the parameter type 'PreferredSizeWidget?'

 

문제 상황 (Problem)

 

Scaffold의 appBar에 Widget을 대입하면, 아래와 같은 빌드 에러가 발생한다.

[English](If Widget is assigned to Scaffold's appBar, the following build error occurs.)

The argument type 'Widget' can't be assigned to the parameter type 'PreferredSizeWidget?'

 

해결 방법 (Solution)

Widget을 반환하는 대신에 PreferredSizeWidget 클래스를 반환하도록 수정하면 된다.

[English](Instead of returning a Widget, you can modify it to return the PreferredSizeWidget class.)

반응형