Home > database >  openAppSettings cause to "Stack Overflow" exception
openAppSettings cause to "Stack Overflow" exception

Time:01-12

I'm using the permission_handler package in my app. I want to open the app's settings using the openAppSetting() function.

Future<void> openAppSettings() async {
    await openAppSettings();
  }

When I trigger the function, I get a Stack Overflow exception:

E/flutter (31105): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Stack Overflow
E/flutter (31105): #0      Future._error (dart:async/future_impl.dart:372:3)
E/flutter (31105): #1      Future._propagateToListeners.handleError (dart:async/future_impl.dart:782:34)
E/flutter (31105): #2      Future._propagateToListeners (dart:async/future_impl.dart:799:13)
E/flutter (31105): #3      Future._completeError (dart:async/future_impl.dart:574:5)
E/flutter (31105): #4      _completeOnAsyncError (dart:async-patch/async_patch.dart:318:13)
E/flutter (31105): #5      _RootZone.runBinary (dart:async/zone.dart:1658:54)
E/flutter (31105): #6      _FutureListener.handleError (dart:async/future_impl.dart:162:22)
E/flutter (31105): #7      Future._propagateToListeners.handleError (dart:async/future_impl.dart:778:47)
E/flutter (31105): #8      Future._propagateToListeners (dart:async/future_impl.dart:799:13)
E/flutter (31105): #9      Future._completeError (dart:async/future_impl.dart:574:5)
E/flutter (31105): #10     _completeOnAsyncError (dart:async-patch/async_patch.dart:318:13)
E/flutter (31105): #11     _RootZone.runBinary (dart:async/zone.dart:1658:54)
E/flutter (31105): #12     _FutureListener.handleError (dart:async/future_impl.dart:162:22)
E/flutter (31105): #13     Future._propagateToListeners.handleError (dart:async/future_impl.dart:778:47)
E/flutter (31105): #14     Future._propagateToListeners (dart:async/future_impl.dart:799:13)
E/flutter (31105): #15     Future._completeError (dart:async/future_impl.dart:574:5)
E/flutter (31105): #16     _completeOnAsyncError (dart:async-patch/async_patch.dart:318:13)
E/flutter (31105): #17     _RootZone.runBinary (dart:async/zone.dart:1658:54)
E/flutter (31105): #18     _FutureListener.handleError (dart:async/future_impl.dart:162:22)
E/flutter (31105): #19     Future._propagateToListeners.handleError (dart:async/future_impl.dart:778:47)
E/flutter (31105): #20     Future._propagateToListeners (dart:async/future_impl.dart:799:13)
E/flutter (31105): #21     Future._completeError (dart:async/future_impl.dart:574:5)
E/flutter (31105): #22     _completeOnAsyncError (dart:async-patch/async_patch.dart:318:13)
E/flutter (31105): #23     _RootZone.runBinary (dart:async/zone.dart:1658:54)
E/flutter (31105): #24     _FutureListener.handleError (dart:async/future_impl.dart:162:22)
E/flutter (31105): #25     Future._propagateToListeners.handleError (dart:async/future_impl.dart:778:47)
E/flutter (31105): #26     Future._propagateToListeners (dart:async/future_impl.dart:799:13)
E/flutter (31105): #27     Future._completeError (dart:async/future_impl.dart:574:5)
E/flutter (31105): #28     _completeOnAsyncError (dart:async-patch/async_patch.dart:318:13)
E/flutter (31105): #29     _RootZone.runBinary (dart:async/zone.dart:1658:54)
E/flutter (31105): #30     _FutureListener.handleError (dart:async/future_impl.dart:162:22)
E/flutter (31105): #31     Future._propagateToListeners.handleError (dart:async/future_impl.dart:778:47)
E/flutter (31105): #32     Future._propagateToListeners (dart:async/future_impl.dart:799:13)
E/flutter (31105): #33     Future._completeError (dart:async/future_impl.dart:574:5)
E/flutter (31105): ...
E/flutter (31105): ...
E/flutter (31105): #8577   Future._completeError (dart:async/future_impl.dart:574:5)
E/flutter (31105): #8578   _completeOnAsyncError (dart:async-patch/async_patch.dart:318:13)
E/flutter (31105): #8579   _RootZone.runBinary (dart:async/zone.dart:1658:54)
E/flutter (31105): #8580   _FutureListener.handleError (dart:async/future_impl.dart:162:22)
E/flutter (31105): #8581   Future._propagateToListeners.handleError (dart:async/future_impl.dart:778:47)
E/flutter (31105): #8582   Future._propagateToListeners (dart:async/future_impl.dart:799:13)
E/flutter (31105): #8583   Future._completeError (dart:async/future_impl.dart:574:5)
E/flutter (31105): #8584   _completeOnAsyncError (dart:async-patch/async_patch.dart:318:13)
E/flutter (31105): #8585   _RootZone.runBinary (dart:async/zone.dart:1658:54)
E/flutter (31105): #8586   _FutureListener.handleError (dart:async/future_impl.dart:162:22)
E/flutter (31105): #8587   Future._propagateToListeners.handleError (dart:async/future_impl.dart:778:47)
E/flutter (31105): #8588   Future._propagateToListeners (dart:async/future_impl.dart:799:13)
E/flutter (31105): #8589   Future._completeError (dart:async/future_impl.dart:574:5)
E/flutter (31105): #8590   _completeOnAsyncError (dart:async-patch/async_patch.dart:318:13)
E/flutter (31105): #8591   _RootZone.runBinary (dart:async/zone.dart:1658:54)
E/flutter (31105): #8592   _FutureListener.handleError (dart:async/future_impl.dart:162:22)
E/flutter (31105): #8593   Future._propagateToListeners.handleError (dart:async/future_impl.dart:778:47)
E/flutter (31105): #8594   Future._propagateToListeners (dart:async/future_impl.dart:799:13)
E/flutter (31105): #8595   Future._completeError (dart:async/future_impl.dart:574:5)
E/flutter (31105): #8596   _completeOnAsyncError (dart:async-patch/async_patch.dart:318:13)
E/flutter (31105): #8597   _RootZone.runBinary (dart:async/zone.dart:1658:54)
E/flutter (31105): #8598   _FutureListener.handleError (dart:async/future_impl.dart:162:22)
E/flutter (31105): #8599   Future._propagateToListeners.handleError (dart:async/future_impl.dart:778:47)
E/flutter (31105): #8600   Future._propagateToListeners (dart:async/future_impl.dart:799:13)
E/flutter (31105): #8601   Future._completeError (dart:async/future_impl.dart:574:5)
E/flutter (31105): #8602   _completeOnAsyncError (dart:async-patch/async_patch.dart:318:13)
E/flutter (31105): #8603   _RootZone.runBinary (dart:async/zone.dart:1658:54)
E/flutter (31105): #8604   _FutureListener.handleError (dart:async/future_impl.dart:162:22)
E/flutter (31105): #8605   Future._propagateToListeners.handleError (dart:async/future_impl.dart:778:47)
E/flutter (31105): #8606   Future._propagateToListeners (dart:async/future_impl.dart:799:13)
E/flutter (31105): #8607   Future._completeError (dart:async/future_impl.dart:574:5)
E/flutter (31105): #8608   Future._asyncCompleteError.<anonymous closure> (dart:async/future_impl.dart:665:7)
E/flutter (31105): #8609   _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
E/flutter (31105): #8610   _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
E/flutter (31105): 

Why is that?

CodePudding user response:

your method name is same . try to change with another name.

Future<void> openAppSettings() async {
    await openAppSettings();
  }

it means you called openAppSettings() inside openAppSettings()

CodePudding user response:

You need to change method name . its conflit here please update with

Future<void> openSettings() async {
    await openAppSettings();
  }
  • Related