botion_flutter_plugin

Creator: coderz1093

Last updated:

0 purchases

botion_flutter_plugin Image
botion_flutter_plugin Images

Languages

Categories

Add to Cart

Description:

botion flutter plugin

botion_flutter_plugin #
The official flutter plugin project for Botion Adaptive CAPTCHA. Support Flutter 2.0.
Official
Install #
Follow the steps below to set up dependencies in project pubspec.yaml
Github integration
dependencies:
botion_flutter_plugin:
git:
url: https://github.com/BotionTeam/botion_flutter_plugin.git
ref: main
copied to clipboard
or
pub integration
dependencies:
botion_flutter_plugin: ^0.0.2
copied to clipboard
Configuration #
Create your IDs and keys (Botion CAPTCHA) on Botion dashboard, and deploy the corresponding back-end API based on otion documents.
Example #
Init #

Please replace random captchaID in the below example with captchaID that you created from Botion dashboard before you process the integration. )

var config = BOCSessionConfiguration();
config.language = "en";
config.debugEnable = true;
config.backgroundColor = Colors.orange;
config.apiServers = ["static.example.com"];
config.staticServers = ["bcaptcha.example.com"];
captcha =
BocFlutterPlugin("123456789012345678901234567890ab",config);
copied to clipboard
config explanation



attribute
attribute types
attribute explanation




resourcePath
String
Static resource file path is the load local file path by default. If ther is no special requirements, you don't need to configure it. You should set the full path for configurable remote files.


protocol
String
It is used for remote access to static resources. The default value is https


userInterfaceStyle
BOC4UserInterfaceStyle
Interface style, enumerationsystem system style light normal style dark dark style iOS default interface is light, Android default interface is system


backgroundColor
Color
it is used for set background color, the default value is transparency.


debugEnable
bool
Debugging mode switch, the default value is turn off


canceledOnTouchOutside
bool
It is used for interaction of background clicking, the default value is on.


timeout
int
Request timeout duration. The unit is milliseconds. The default value is 8000 for iOS and 10000 for Android


language
String
It is used for language setting, the default value is the same as system language. The default language will be Chinese if your system language is not included in Botion multilingual setting. Refer to the list of language short codes in the documentation (ISO 639-2) to specify the language.


additionalParameter
Map<String,dynamic>
Additional parameters, null by default. The parameters will be assembled and submitted to the verification service.



Verify #
captcha.verify();
copied to clipboard
Close #
captcha.close();
copied to clipboard
addEventHandler #
captcha.addEventHandler(onShow: (Map<String, dynamic> message) async {
// TO-DO
// the captcha view is displayed
debugPrint("Captcha did show");
}, onResult: (Map<String, dynamic> message) async {
debugPrint("Captcha result: " + message.toString());

String status = message["status"];
if (status == "1") {
// TODO
// Send the data in the message ["result"] to query your API
// validate the result
Map result = message["result"] as Map;

} else {
// If the verification fails, it will be automatically retried.
debugPrint("Captcha 'onResult' state: $status");
}
}, onError: (Map<String, dynamic> message) async {
debugPrint("Captcha onError: " + message.toString());
String code = message["code"];
// TODO Handling errors returned in verification
if (Platform.isAndroid) {
// Android
if (code == "-14460") {
// The authentication session has been canceled
} else {
// More error codes refer to the development document
// https://docs.botion.com/boc/apirefer/errorcode/android
}
}

if (Platform.isIOS) {
// iOS
if (code == "-20201") {
// Verify request timeout
}
else if (code == "-20200") {
// The authentication session has been canceled
}
else {
// More error codes refer to the development document
// https://docs.botion.com/boc/apirefer/errorcode/ios
}
}
});
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.