setUser method

  1. @override
Future<bool> setUser({
  1. String? userId,
  2. String? name,
  3. String? email,
  4. String? phone,
})
override

Set/update the current user information.

This method should be called after initialization to identify the user.

Parameters:

  • userId - Unique identifier for the user
  • name - User's display name
  • email - User's email address
  • phone - 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;
  }
}