How to disable reloading or refresh button in browser in flutter web?

Issue

I have an exam with a timer inside a widget I want to prevent users from reloading or show a confirmation dialog

Solution

I didn’t find a solution but I found that I can excute some code before reloading:

import 'dart:html' as html;
html.window.onUnload.listen((event) async {
  print('Reloaded');
  
});

Answered By – Abdelrahman Tareq

Answer Checked By – Mary Flores (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *