initialize method

  1. @override
Future<bool> initialize(
  1. String? defaultIcon,
  2. List<NotificationChannel> channels, {
  3. List<NotificationChannelGroup>? channelGroups,
  4. bool debug = false,
  5. String? languageCode,
})
override

Initializes the plugin by creating a default icon and setting up the initial notification channels. This method only needs to be called once in the main.dart file of your application.

The defaultIcon parameter specifies the resource media type of the default icon that will be used for notifications. This should be a String representing the resource name.

The channels parameter is a list of NotificationChannel objects that represent the initial notification channels to be created. If any of the channels already exist, they will be updated with the provided information.

The optional channelGroups parameter is a list of NotificationChannelGroup objects that are used to organize the channels visually in Android's notification configuration page.

The optional debug parameter enables verbose logging in Awesome Notifications.

The optional languageCode parameter is a String that represents the localization code for translating notification content. If specified, this code will be used to translate notification titles, bodies, and other contents into the appropriate language.

This method returns a Future that resolves to true if the initialization was successful, or false if an error occurred.

Implementation

@override
Future<bool> initialize(
  String? defaultIcon,
  List<NotificationChannel> channels, {
  List<NotificationChannelGroup>? channelGroups,
  bool debug = false,
  String? languageCode,
}) {
  return AwesomeNotificationsPlatform.instance.initialize(
      defaultIcon, channels,
      channelGroups: channelGroups, languageCode: languageCode, debug: debug);
}