Unhandled Exception: PlatformException for cloudinary images flutter

199 Views Asked by At

I am wanting to share the some details to whatsapp with preview of image which I will send in the payload , how to do ?

Presently working with whatsapp_share package of flutter. Getting exception

E/flutter (31514): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] 
                  Unhandled Exception: PlatformException(Failed to find configured root that contains 
                  /https:/res.cloudinary.com/dpurb6xes/image/upload/v1692525937/vivans/lsndtdivs4xldbbgoem8.png, 
                   null, null, null)

My provider_path.xml

<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
    <external-path
        name="external_files"
        path="/https:/res.cloudinary.com/dpurb6xes/image/upload/" />
        
</paths>
1

There are 1 best solutions below

0
Danny V On

I'm not a Flutter dev myself, however I do work on Cloudinary's Support team and wanted to provide some insight as to what may be occurring here.

From my understanding, WhatsApp requires Open Graph meta tags to be present in a web page in order to do a "rich" embed of content in a message. You can't simply provide an image URL, sadly. There have to be metadata fields included so WhatsApp knows how to parse the content.

  • "og:title" should contain the title of your content
  • "og:description" would be a rich description of what your content is
  • "og:url" is the canonical URL of the content you're sharing
  • "og:image" is the URL of the image that should be displayed in the preview

You'd want to provide something along the lines of the following:

<html>
<head>
<meta property="og:title" content="Oreo cake" />
<meta property="og:description" content="A decadent Oreo drip-cake, with six halved Oreos as decorative toppings" />
<meta property="og:url" content="https://yoursite.com/shares/oreocake" />
<meta property="og:image" content="https://res.cloudinary.com/dpurb6xes/image/upload/v1692525937/vivans/lsndtdivs4xldbbgoem8.png" />
</head>
</html>