Last active
September 25, 2022 13:21
-
-
Save VB10/3208e7d8859b3fb5da90df6d621ffda6 to your computer and use it in GitHub Desktop.
Native Gallery open code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:io'; | |
| import 'package:url_launcher/url_launcher.dart'; | |
| mixin GalleryLaunch { | |
| final String _iosPhotoScheme = 'photos-redirect://'; | |
| final String _androidPhotoScheme = 'content://media/external/images/media'; | |
| /// It'll be open gallery on device | |
| /// | |
| /// If you want to open specific image on android, you should be call media/56.png | |
| Future<void> open() async { | |
| await launchUrl(Uri.parse(Platform.isIOS ? _iosPhotoScheme : _androidPhotoScheme)); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment