fcm_config 1.0.0-beta.1 copy "fcm_config: ^1.0.0-beta.1" to clipboard
fcm_config: ^1.0.0-beta.1 copied to clipboard

outdated

A new Flutter package project.

fcm_config #

What can this packge do #

  • Show fcm notification while app is in forground
  • Easly recieve incoming notification where you are
  • Easly recieve clicked where you are
  • Notification is an object

Setup #

Native #

Dart/Flutter #

Initialize

  FCMConfig.initialize(
    androidChannelDiscription: "Your channel channel",
    androidChannelId: "channel id",
    androidChannelName: "Channel name",
    forgroundIconName: "ic_launcher" // must be in drawble android folder,
  );

No if you need to get the incomming notification :

First option #

class MyScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return FCMNotificationLisner(
      onNotification:
          (FCMNotification notification, void Function() setState) {},
      child: SizedBox(),
    );
  }
}

Second option #

class MyScreen extends StatefulWidget {
  @override
  _MyScreenState createState() => _MyScreenState();
}

class _MyScreenState extends State<MyScreen>
    with FCMNotificationMixin {
  @override
  Widget build(BuildContext context) {
    return SizedBox();
  }

  @override
  void onNotify(FCMNotification notification) {
    // do some thing
  }
}

additional property translateMessage that can be passed in intialize to translate body_loc_key,title_loc_key it currently support only forground notification #