Why does the Flutter app gets restarted upon setting a wallpaper?

132 views Asked by At

I have made a wallpaper app using Flutter. I have used the below package to help user set the wallpaper as HOME, LOCK or BOTH screens. But after setting any image to wallpaper, the whole app gets restarted.

package ss

Future<void> _setwallpaper(imagePath, location) async {
    var file = await DefaultCacheManager().getSingleFile(imagePath);

   
      WallpaperManagerFlutter().setwallpaperfromFile(file, location);

   }

I tried other packages like wallpaper and flutter_wallpaper_manager. However, the same issue exists with these packages as well.

How can I prevent a restart of the flutter app upon setting a wallpaper?

0

There are 0 answers