最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Flutter permission_handler 權(quán)限插件的使用詳解

 更新時(shí)間:2020年04月13日 11:39:18   作者:xudailong_blog  
這篇文章主要介紹了Flutter permission_handler 權(quán)限插件的使用,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

編譯環(huán)境:Flutter 版本v1.12.hotfix9 dart SDK:2.7.2

1 pubspec.yaml中引入:

  #  權(quán)限
  permission_handler: ^3.2.0

ios中info.plist配置(根據(jù)權(quán)限情況使用):

 <!-- Permission options for the `location` group -->
 <key>NSLocationWhenInUseUsageDescription</key>
 <string>Need location when in use</string>
 <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
 <string>Always and when in use!</string>
 <key>NSLocationUsageDescription</key>
 <string>Older devices need location.</string>
 <key>NSLocationAlwaysUsageDescription</key>
 <string>Can I haz location always?</string>

 <!-- Permission options for the `mediaLibrary` group -->
 <key>NSAppleMusicUsageDescription</key>
 <string>Music!</string>
 <key>kTCCServiceMediaLibrary</key>
 <string>media</string>

 <!-- Permission options for the `calendar` group -->
 <key>NSCalendarsUsageDescription</key>
 <string>Calendars</string>

 <!-- Permission options for the `camera` group -->
 <key>NSCameraUsageDescription</key>
 <string>camera</string>

 <!-- Permission options for the `contacts` group -->
 <key>NSContactsUsageDescription</key>
 <string>contacts</string>

 <!-- Permission options for the `microphone` group -->
 <key>NSMicrophoneUsageDescription</key>
 <string>microphone</string>

 <!-- Permission options for the `speech` group -->
 <key>NSSpeechRecognitionUsageDescription</key>
 <string>speech</string>

 <!-- Permission options for the `sensors` group -->
 <key>NSMotionUsageDescription</key>
 <string>motion</string>

 <!-- Permission options for the `photos` group -->
 <key>NSPhotoLibraryUsageDescription</key>
 <string>photos</string>

 <!-- Permission options for the `reminder` group -->
 <key>NSRemindersUsageDescription</key>
 <string>reminders</string>

2 代碼中具體使用:

 void chosePhoto(int index) async {
 PermissionHandler().requestPermissions(
 [PermissionGroup.photos, PermissionGroup.camera]).then((map) {
 if (map[PermissionGroup.photos] == PermissionStatus.granted ||
  map[PermissionGroup.camera] == PermissionStatus.granted) {
 chosePhotoFromPhone(context, index);
 }
 });
 }

3 總結(jié):

在使用的過程中可能會(huì)出現(xiàn)androidX 或者Swift語言的適配,這時(shí)候需要根據(jù)具體情況進(jìn)行修改。

到此這篇關(guān)于Flutter permission_handler 權(quán)限插件的使用的文章就介紹到這了,更多相關(guān)Flutter permission_handler 權(quán)限插件內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論

游戏| 三穗县| 昌图县| 沂南县| 台南县| 浙江省| 凤翔县| 博湖县| 民勤县| 穆棱市| 关岭| 宁夏| 华亭县| 辽宁省| 岢岚县| 古浪县| 红原县| 开江县| 报价| 菏泽市| 江西省| 宾川县| 台湾省| 苍南县| 醴陵市| 广丰县| 县级市| 历史| 安图县| 台北县| 宁河县| 新蔡县| 增城市| 勐海县| 淮北市| 曲麻莱县| 福建省| 新郑市| 沁水县| 佳木斯市| 泾阳县|