login static method
- required String userIdentifier,
- String fcmToken = "",
- String userType = "d",
- bool isForceRegister = true,
- List<
IdentifierMetaData> ? identifierMetaData, - required dynamic flyCallback(
- FlyResponse response
Provides functionality to log in a user to the Mirrorfly platform.
This static method initiates the login process for a user with the specified userIdentifier to the Mirrorfly platform.
Optionally, you can provide the fcmToken for Firebase Cloud Messaging (FCM) integration,
and specify whether to forcefully register the user if not already registered with isForceRegister.to specify the app user type use userType.
The flyCallback function is called upon completion of the login operation,
providing a FlyResponse object containing information about the operation's success or failure.
The identifierMetaData parameter is optional and represents additional metadata associated with the User.
Throws an error if the userIdentifier is not provided.
Example usage:
await Mirrorfly.login(
userIdentifier: 'example_user_id',
fcmToken: 'example_fcm_token',
userType: 'd'
isForceRegister: true,
flyCallback: (FlyResponse response) {
if (response.success) {
print('User logged in successfully.');
} else {
print('Login failed: ${response.errorMessage}');
}
},
);
Note: This method is a static member of the Mirrorfly class.
Implementation
static Future<void> login(
{required String userIdentifier,
String fcmToken = "",
String userType = "d",
bool isForceRegister = true,
List<IdentifierMetaData>? identifierMetaData,
required Function(FlyResponse response) flyCallback}) {
return FlyChatFlutterPlatform.instance.registerUser(userIdentifier,
fcmToken: fcmToken,
userType: userType,
isForceRegister: isForceRegister,
identifierMetaData: identifierMetaData,
callback: flyCallback);
}