Want to check if a widget/page is rendered in flutter? The code bellow allows to check if the page is visible for a user:
1 2 3 4 5 6 7 8 9 |
import 'package:flutter/material.dart'; class TestWidget extends StatelessWidget { @override Widget build(BuildContext context) { print('TestWidget: ${ModalRoute.of(context).isCurrent}'); return Container(); } } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.