mounted property

  1. @override
bool mounted

Whether the Widget this context is associated with is currently mounted in the widget tree.

Accessing the properties of the BuildContext or calling any methods on it is only valid while mounted is true. If mounted is false, assertions will trigger.

Once unmounted, a given BuildContext will never become mounted again.

If a BuildContext is used across an asynchronous gap (i.e. after performing an asynchronous operation), consider checking mounted to determine whether the context is still valid before interacting with it:

  Widget build(BuildContext context) {
    return OutlinedButton(
      onPressed: () async {
        await Future<void>.delayed(const Duration(seconds: 1));
        if (context.mounted) {
      child: const Text('Delayed pop'),


bool get mounted => _widget != null;