setIcon method

  1. @override
Future<Map<String, dynamic>> setIcon(
  1. String? iconName
)
override

Sets the app icon to the specified icon name.

iconName - The name of the icon to set. Pass null to reset to default. Returns a map containing:

  • success (bool)
  • iconName (String?) for successful updates
  • error (String?) or errorMessage (String?) for failed updates

Implementation

@override
Future<Map<String, dynamic>> setIcon(String? iconName) async {
  try {
    final result = await methodChannel.invokeMethod<Map<dynamic, dynamic>>(
      'setIcon',
      {'iconName': iconName},
    );
    return Map<String, dynamic>.from(result ?? {'success': false, 'error': 'No response from platform'});
  } on PlatformException catch (e) {
    return {'success': false, 'error': e.message};
  }
}