It showing the only recent pictures. I want a camera option too. Here is my code.

  Future<void> loadAssets(StateSetter setModalState) async {
    print("On pressed");
    List<Asset> resultList = List<Asset>();
    String error = 'No Error Dectected';

    try {
      resultList = await MultiImagePicker.pickImages(
        maxImages: 2,
        enableCamera: true,
        selectedAssets: image,
        materialOptions: MaterialOptions(
          actionBarColor: "#abcdef",
          actionBarTitle: "Example App",
          allViewTitle: "All Photos",
          useDetailsView: false,
          selectCircleStrokeColor: "#000000",
        ),
      );
    } on Exception catch (e) {
      error = e.toString();
    }

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setModalState(() {
      image = resultList;
      print("Set state");
      if(image.length>0){
        showUploadButton = false;
      }else{
        showUploadButton = true;
      }

     // _error = error;
      //print(_error);
    });
  }

I don't know why this happening. I already delete the app and reinstall.And also clean the android studio. But it still shows only recent pictures

1

There are 1 answers

2
Junsu Cho On

write in info.plist

    <key>NSPhotoLibraryUsageDescription</key>
    <string>This app requires access to the photo library.</string>
    <key>NSMicrophoneUsageDescription</key>
    <string>This app does not require access to the microphone.</string>
    <key>NSCameraUsageDescription</key>
    <string>This app requires access to the camera.</string>

enter image description here