createCustomChannel method
Future<bool>
createCustomChannel({
- required String channelId,
- required String channelName,
- String? channelDescription,
- int? importance,
- bool? enableLights,
- int? lightColor,
- bool? enableVibration,
- bool? enableSound,
override
Create a custom notification channel.
This is only needed for Android 8.0+ (API level 26+). Returns true if the channel was created successfully.
Implementation
@override
Future<bool> createCustomChannel({
required String channelId,
required String channelName,
String? channelDescription,
int? importance,
bool? enableLights,
int? lightColor,
bool? enableVibration,
bool? enableSound,
}) async {
final result = await methodChannel
.invokeMethod<bool>('createCustomChannel', {
'channelId': channelId,
'channelName': channelName,
if (channelDescription != null)
'channelDescription': channelDescription,
if (importance != null) 'importance': importance,
if (enableLights != null) 'enableLights': enableLights,
if (lightColor != null) 'lightColor': lightColor,
if (enableVibration != null) 'enableVibration': enableVibration,
if (enableSound != null) 'enableSound': enableSound,
});
return result ?? false;
}