Home > Software design >  Open Image Gallery (Photo Album) Application in Flutter
Open Image Gallery (Photo Album) Application in Flutter

Time:11-17

How to open Image Gallery (Android) or Photo Album (iOS) in Flutter. I don't want to pick an image from the image gallery. What I want is to open the image gallery application programmatically.

I tried to search Flutter open image gallery application. All of the results are teaching me how to use image_picker package. But what is not what I want.

I have tried to use url_launcher package. This is what I have tried (it seemed to work on iOS but I am not sure if it is appropriate):

import 'package:url_launcher/url_launcher.dart';

if (Platform.isIOS) {
  String _url = "photos-redirect://";
  if (await canLaunch(_url)) {
    launch(_url);
  }
} else if (Platform.isAndroid) {
  // To DO
}

CodePudding user response:

Your approach is appropriate for iOS. For Android, you can use the android_intent_plus plugin.

const intent = AndroidIntent(
  action: 'action_view',
  type: 'image/*',
  flags: [Flag.FLAG_ACTIVITY_NEW_TASK],
);
intent.launch();
  • Related