decodeUrlContent
The decodeUrlContent API is called by the super app to decode the URL that is generated from a promotion QR code.
Method signature
copy
Future<MiniApiResult<String>> decodeUrlContent(String url);Request parameters
Field | Data type | Required | Description |
url | String | Yes | Indicates the URL content to be decoded. |
Response parameters
The response of this API is MiniApiResult<String>. For details, see MiniApiResult.
Sample
copy
void _decodeUrl(String qrUrl) async {
final decodeResult = await IAPMiniProgram.instance.decodeUrlContent(qrUrl);
String url = decodeResult.data ?? "";
if(decodeResult.success && url.isNotEmpty) {
IAPMiniProgram.instance.openUrl(url);
} else {
///decodeUrlContent fail
}
}For more information about openUrl, see openUrl API doc.