community icon indicating copy to clipboard operation
community copied to clipboard

MaterialMaterialPageRoute bulider

Open ahmedrabeasmaha opened this issue 4 years ago • 1 comments

MaterialPageRoute(
    builder: (context) => ScanQR(),
)

i want to know why i can't type ScanQR() or ScanQR(context) and why to use () =>

ahmedrabeasmaha avatar Jun 06 '21 15:06 ahmedrabeasmaha

The builder requires a function that takes a BuildContext and returns a Widget.

Passing in ScanQR() would return just Widget. This is not what the builder wants as Widget != (BuildContext) => Widget.

navaronbracke avatar Aug 14 '21 19:08 navaronbracke