0

I have made my flutter project (windows platform) using android studio, I build the application than use inno setup to create a setup file but when I run the application after installation it runs in background not in foreground. I am creating windows based flutter application for the first time. I might miss some important thing like permission or something else please guide me how can I fix this issue. Also when I build the application and I run it from the release folder I works fine.

If you want to see any part of the code or anything else I can provide you. I don't know what are the relevant things to share.

I am using following dependencies(might be relevant):

dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^1.0.2
  motion_toast: ^2.7.8
  sqflite_common_ffi: ^2.3.0+2
  path_provider: ^2.1.1
  intl: ^0.18.1
  image_picker: ^1.0.4
  get: ^4.6.6

I tried to build the setup by using winRar and inno setup but it still runs in background

Edit: Result of flutter doctor

PS C:\Users\ARcaN\Desktop\sharespace> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.13.5, on Microsoft Windows [Version 10.0.19045.3516], locale en-PK)
[√] Windows Version (Installed version of Windows is version 10 or higher)                        
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)                  
[√] Chrome - develop for the web                                                
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.7.4)  
[√] Android Studio (version 2022.3)                                             
[√] VS Code (version 1.83.0)
[√] Connected device (4 available)
[√] Network resources

• No issues found!
2
  • Are you using latest version of flutter? can you post flutter doctor result? Commented Oct 5, 2023 at 11:38
  • @Zahra I updated my question and add the result of flutter doctor Commented Oct 5, 2023 at 12:53

1 Answer 1

0

Try to add restorationScopeId to materialApp based on this issue like this:

class MyApp extends StatelessWidget {
  const MyApp({super.key});
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      restorationScopeId: "some-Id-here",//Add this line
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Home Page'),
    );
  }
}

and this is some more solutions if it didn't work.

Sign up to request clarification or add additional context in comments.

7 Comments

I Tried both the solutions but it didn't work
Did you cleaned the project?
Yes, I did clean the project
Try running the exe file as Administrator.
No, still it didn't work? Is there anything I am missing or didn't notice? I am making the windows application for the first time so I think I might doing something wrong. If you want I can share you my code
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.