본문 바로가기
2023년 부터/Flutter

[Flutter] 버그 & 이슈(The following assertion was thrown building Scaffold(dirty, state: ScaffoldState#5a617(tickers: tracking 2 tickers)):No Directionality widget found.)

by JeongUPark 2024. 3. 26.
반응형

 

Flutter 개발을 하다보면 아래와 같은 버그를 확인하는 경우가 발생합니다.

<aside> ⚠️ The following assertion was thrown building Scaffold(dirty, state: ScaffoldState#5a617(tickers: tracking 2 tickers)): No Directionality widget found.

Scaffold widgets require a Directionality widget ancestor.

The specific widget that could not find a Directionality ancestor was: Scaffold dirty state: ScaffoldState#5a617(tickers: tracking 2 tickers) The ownership chain for the affected widget is: "Scaffold ← InputNameScreen ← MediaQuery ← _MediaQueryFromView ← _PipelineOwnerScope ← _ViewScope ← _RawView-[_DeprecatedRawViewKey FlutterView#6a953] ← View ← [root]"

</aside>

 

위와 같은 버그가 나타나는 이유는 간단하게 Scaffold쓸려고하는데 부모 widget어디에도 MaterialApp 이 없어서 발생하는 문제였습니다.

 

main 함수 혹은 첫 Widget에서 build호출될 때 MaterialApp을 포함하여 반환하면 문제가 사라집니다.

반응형