I have created a flutter project (windows platform). 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 tried run it with administrator, still it run in background. 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 It still run in background.
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.19.0
image_picker: ^1.0.4
get: ^4.6.6
main.dart:
import 'package:attendance_system/splashScreen.dart';
import 'package:flutter/material.dart';
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
import 'database.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
sqfliteFfiInit();
databaseFactory = databaseFactoryFfi;
final dbHelper = DatabaseHelper.instance;
dbHelper.db;
runApp(
MaterialApp(
restorationScopeId: "some-Id-here",
title: 'Attendance',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.green),
useMaterial3: true,
),
debugShowCheckedModeBanner: false,
initialRoute: 'SplashScreen',
routes: {
'SplashScreen': (context) => const SplashScreen(),
},
),
);
}
I tried to build the setup by using winRar and inno setup but it still runs in background
Result of flutter doctor
PS C:\Users\ARcaN\Desktop\Projects\Attendance System> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.16.5, on Microsoft Windows [Version 10.0.19045.3803], locale en-US)
[√] 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.8.3)
[√] Android Studio (version 2022.3)
[√] VS Code (version 1.85.1)
[√] Connected device (3 available)
[√] Network resources
• No issues found!
ALSO guide me how can I build the .exe for distribution to run the application on another device
Did you create your Flutter project using a Flutter Version < 3.13?
See https://github.com/flutter/flutter/issues/119415 for reference.
Apps created using Flutter 3.7 or 3.10 will need to be migrated after they've upgraded to Flutter 3.13 or the master channel. This migration will be automatic if the Windows project has not been modified.
If the Windows project has been modified the easiest way to recreate the
flutter_window.cppfile would be to delete the whole windows-folder and runflutter create --platforms windows .in your existing project with the latest Flutter version.