setUser method
Set/update the current user information.
This method should be called after initialization to identify the user.
Parameters:
userId- Unique identifier for the username- User's display nameemail- User's email addressphone- User's phone number
Returns true if user information was set successfully, false otherwise.
Implementation
@override
Future<bool> setUser({
String? userId,
String? name,
String? email,
String? phone,
}) async {
try {
final result = await methodChannel.invokeMethod<bool>('setUser', <String, String?>{
'userId': userId,
'name': name,
'email': email,
'phone': phone,
});
return result ?? false;
} on PlatformException catch (e) {
debugPrint('Failed to set user: ${e.message}');
return false;
}
}