Sunday, December 15, 2024
HomeiOS Developmentios - Why no location settings displaying up in my simulator app...

ios – Why no location settings displaying up in my simulator app settings?


//pubspec.yaml 
permission_handler: ^11.3.1
import 'package deal:flutter/materials.dart';
import 'package deal:permission_handler/permission_handler.dart';

void predominant() => runApp(MaterialApp(house: MyHome()));

class MyHome extends StatefulWidget {
  @override
  _MyHomeState createState() => _MyHomeState();
}

class _MyHomeState extends State {
  PermissionStatus _status = PermissionStatus.denied; // Begin with denied state
 @override
  void initState() {
    tremendous.initState();
    _checkPermissionStatus();
  }

  Future _checkPermissionStatus() async {
    remaining standing = await Permission.locationWhenInUse.standing;
    _updateStatus(standing);
  }

  void _updateStatus(PermissionStatus standing) {
    if (standing != _status) {
      setState(() {
        _status = standing;
      });
    }
  }

  Future _requestPermission() async {
    remaining standing = await Permission.locationWhenInUse.request();
    _updateStatus(standing);

    if (standing.isDenied) {
      _showDialog('Permission Denied', 'Location permission is denied.');
    } else if (standing.isPermanentlyDenied) {
      _showDialog(
        'Permission Completely Denied',
        'Please allow location permission in settings.',
        showSettings: true,
      );
    }
  }

  
  @override
  Widget construct(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Textual content('Permission Handler Instance'),
      ),
      physique: SafeArea(
        little one: Middle(
          little one: Column(
            mainAxisAlignment: MainAxisAlignment.heart,
            youngsters: [
              Text('Location Permission Status: $_status'),
              SizedBox(height: 20),
              ElevatedButton(
                onPressed: _requestPermission,
                child: Text('Request Location Permission'),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

I attempted flutter clear then flutter construct however nonetheless there isn’t a settings about location in my
iOS simulator ?
my dependencies appears okey my plist appears okey however nonetheless nothing …
particulars in regards to the questions ………………………………………………………………..
………..
……
.
.
.
..
.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments