),

);

},

);

The new approach calls on the ScaffoldMessenger to show
the SnackBar. In this case, the Builder is no longer
required to provide a new scope with a BuildContext that
is “under” the Scaffold.

Scaffold

key:

scaffoldKey

body:

GestureDetector

onTap:

()

ScaffoldMessenger

of

context

showSnackBar

SnackBar

content:

const

Text

'snack'

),

duration:

const

Duration

seconds:

),