I'm using flutter for develop mobile application. There is pdf generation process inside app after generate pdf need to open os default share options. For that I'm use flutter share-extend library.

To get temporary location I use path provider library. Using this I get temp location and store pdf on that location.

Future<String> get localPath async {
Directory tempDir = await getTemporaryDirectory();
return tempDir.path;
}

This is hoe I use share extend to open default share options.

var dir = await localPath;
File shareFile = File("$dir/$fileNameToGenerate.pdf");
ShareExtend.share(shareFile.path, "file",
    sharePanelTitle: sharePanelTitle, subject: shareSubject);

It gives options to share and no problem with process. But there is security exception in the console.

E/DatabaseUtils(15076): java.lang.SecurityException: Permission Denial: reading com.zt.shareextend.ShareExtendProvider uri content://com.example.agile_iq.shareextend.fileprovider/%252Fdata%252Fuser%252F0%252Fcom.example.agile_iq%252Fcache%252FAgileiq_Assessment_202005181731.pdf from pid=12492, uid=1000 requires the provider be exported, or grantUriPermission()
E/DatabaseUtils(15076):     at android.content.ContentProvider.enforceReadPermissionInner(ContentProvider.java:729)
E/DatabaseUtils(15076):     at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:602)
E/DatabaseUtils(15076):     at android.content.ContentProvider$Transport.query(ContentProvider.java:231)
E/DatabaseUtils(15076):     at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:104)
E/DatabaseUtils(15076):     at android.os.Binder.execTransactInternal(Binder.java:1021)
E/DatabaseUtils(15076):     at android.os.Binder.execTransact(Binder.java:994)

In manifest file I tried to import provider.

<provider
        android:name="androidx.core.content.FileProvider"
        android:authorities="${applicationId}.provider"
        android:exported="false"
        android:grantUriPermissions="true">
        <meta-data
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@xml/file_provider_paths" />

But after import this project atleast not building. Is there any solution for this.