data_dome_plugin 1.0.2 data_dome_plugin: ^1.0.2 copied to clipboard
Plugin for DataDome.
DataDome plugin for Flutter #
Flutter has it's own network implementation, but this plugin uses URLSession and OkHttp for iOS and Android, respectively.
Note
If your project doesn't support swift/kotlin then you can check here.
iOS #
- Add the key
DataDomeKey
with your DataDome key string value to../ios/Runner/Info.plist
. - Add the key
DataDomeProxyEnabled
with the boolean valueNO
to../ios/Runner/Info.plist
.
Forcing captcha display on iOS.
Android #
The method call has a key parameter that is used to pass the DataDome key.
Forcing captcha display on Android but could not get it to work.
Usage #
try {
final headers = {
'Content-type': 'application/json',
'Accept': 'application/json',
};
//TODO: fill in url, DataDome key for android
final key = '';
final url = '';
final json = {
"any": "body",
"some": 1,
"is": true,
};
final body = Uint8List.fromList(utf8.encode(jsonEncode(json)));
final result = await DataDomePlugin.httpCall(
HttpMethod.post,
url,
headers,
body,
key,
);
final response = _makeResponse(result);
print(response.statusCode.toString());
} on PlatformException {
print('Failed HTTP call');
}
.
.
.
http.Response _makeResponse(Map<String, dynamic> resp) {
final int code = resp['code'] ?? 500;
final Uint8List data = resp['data'] ?? Uint8List(0);
return http.Response.bytes(
data.toList(),
code,
headers: {'content-type': 'application/json; charset=utf-8'},
);
}