findProfileIdByName method

String? findProfileIdByName(
  1. String name
)

Finds a profile ID by profile name.

name - Name of the profile to find Returns the profile ID if found, otherwise null. Throws an exception if profiles have not been loaded.

Implementation

String? findProfileIdByName(String name) {
  if (_profiles == null) {
    throw Exception('Launcher profiles not loaded');
  }

  for (final entry in _profiles!.profiles.entries) {
    if (entry.value.name == name) {
      return entry.key;
    }
  }

  return null;
}