Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

flutter refresh page

// Just insert this code to button to refresh page

Navigator.pushAndRemoveUntil(
  context,
  MaterialPageRoute(builder: (context) => MainPage()), // this mainpage is your page to refresh
  (Route<dynamic> route) => false,
);

// Example
IconButton(
	onPressed: () {
    	Navigator.pushAndRemoveUntil(
  			context,
  			MaterialPageRoute(builder: (context) => MyMainPage()), // this mymainpage is your page to refresh
  			(Route<dynamic> route) => false,
		);
    },
    icon: const Icon(Icons.refresh),
),
 
PREVIOUS NEXT
Tagged: #flutter #refresh #page
ADD COMMENT
Topic
Name
9+7 =