registerUser method
Future<void>
registerUser(
- String userIdentifier, {
- String fcmToken = FlyConstants.empty,
- bool isForceRegister = true,
- String userType = "",
- List<
IdentifierMetaData> ? identifierMetaData, - required dynamic callback(
- FlyResponse response
override
This method is used to register the user.
Implementation
@override
Future<void> registerUser(String userIdentifier,
{String fcmToken = FlyConstants.empty,
bool isForceRegister = true,
String userType = "",
List<IdentifierMetaData>? identifierMetaData,
required Function(FlyResponse response) callback}) async {
String? registerResponse;
try {
registerResponse =
await mirrorFlyMethodChannel.invokeMethod('register_user', {
"userIdentifier": userIdentifier,
"token": fcmToken,
"userType": userType,
"isForceRegister": isForceRegister,
"metaData": identifierMetaData != null
? List<dynamic>.from(identifierMetaData.map((x) => x.toMap()))
: null
});
var res = convertRegisterUserJsonFromString(registerResponse);
callback.call(FlyResponse(true, res, "Registered Successfully"));
} on PlatformException catch (e) {
LogMessage.d("Platform Exception =", " $e");
callback.call(FlyResponse(false, FlyConstants.empty, FlyConstants.empty,
FlyException(e.code, e.message, e.details)));
} on Exception catch (e) {
LogMessage.d("Exception ", " $e");
callback.call(FlyResponse(false, FlyConstants.empty, FlyConstants.empty,
FlyException(FlyErrorCode.unHandle, FlyErrorMessage.unHandle, e)));
}
}