Don't use 'BuildContext's across async gaps – where does the mounted property come from?
Advertisements How to rewrite this to awoid Don’t use ‘BuildContext’s across async gaps. warning. onPressed: () async { if (snapshot.hasData) { final isRapportExist = await bloc.isRapportExist(); if (isRapportExist) { return; } bloc.submitRapport(); Navigator.pop(context, true); //Don’t use ‘BuildContext’s across async gaps. } }, In such cases usully mounted property used, but where it comes from? if(!mounted)… Read More Don't use 'BuildContext's across async gaps – where does the mounted property come from?