0

I have coded an application that I have only optimized for the size of the phone (it is responsive on the phone). Now I want it not to be run or installed when the user runs it with the emulator on the computer?! is there a way I have made my software responsive with package sizer.

I did this so that the software does not rotate, But I don't know how to make it display only for android resolution.

void main() {

  WidgetsFlutterBinding.ensureInitialized();
  SystemChrome.setPreferredOrientations(
    [
      DeviceOrientation.portraitUp,
      DeviceOrientation.portraitDown,
    ],
  );

  runApp(const MyApp());
}
FORGE096
  • 3
  • 2

1 Answers1

0

You can check the device height / width / resolution at runtime using MediaQuery. If the current device's resolution is not as per your app's preference you can show some alert message to the user like :

App is only optimized for mobile devices

And upon closing the modal exit the app programmatically using exit(0)

Just for reference Flutter how to programmatically exit the app

Ganapat
  • 6,984
  • 3
  • 24
  • 38