Skip to content

App crashes, after toggling off notification #267

@joselee37

Description

@joselee37

app_crash: https://github.com/user-attachments/assets/9e0506d0-e507-4231-ae7d-7add3dea50d2
without_package: https://github.com/user-attachments/assets/7ea9ba4c-c3b5-4bfa-abf6-208e6fe30765

Hi,

I’m not completely sure if this is an issue with this package itself, but I’m seeing a crash/termination when navigating to the system notification settings from my Flutter app using this package.

When I run the following minimal app and then turn off notifications for the app in the system settings screen, the app dies.

import 'package:flutter/material.dart';
import 'package:app_settings/app_settings.dart';

void main(List<String> args) {
  WidgetsFlutterBinding.ensureInitialized();

  runApp(MaterialApp(home: SettingsNotificationsScreen()));
}

class SettingsNotificationsScreen extends StatefulWidget {
  const SettingsNotificationsScreen({super.key});

  @override
  State<SettingsNotificationsScreen> createState() => _SettingsNotificationsScreenState();
}

class _SettingsNotificationsScreenState extends State<SettingsNotificationsScreen> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: Center(
          child: FilledButton.icon(
            onPressed: () {
              AppSettings.openAppSettings(type: AppSettingsType.notification);
            },
            label: Text('go to system settings'),
          ),
        ),
      ),
    );
  }
}

Steps to reproduce

  1. Run the app above.
  2. Tap “go to system settings” button.
  3. In the system screen that opens, turn off notifications for this app.
  4. Go back to the app.

Actual behavior

  • After turning notifications off (and returning to the app), the app process dies / the app crashes.

Expected behavior

  • The app should keep running normally after returning from the system notification settings screen, or provide a way to restart the app just like android OS do(second video).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions