title: I am trying to save the notification title and body using shared preference but i am unable to
body: <p>#I am trying to save the notification title and body locally and fetch the title and body inside my app to show all the sent notification in a listview but i am unable to</p>
  <p>#this is the code i am running this code in my main.dart inside initstate and that detail.add is my list which i created manually but i am getting error saying 102:45: Error: This expression has type 'void' and can't be used.prefs.setString('notificationData', setData); when i try to setString this is the error i get</p>
  <pre><code>List&lt;String?&gt; detail = [];
  FirebaseMessaging.onMessage.listen((message) async{
        if(message.notification!=null){
          // print(message.notification!.body);
          // print(message.notification!.title);
          final title = message.notification?.title;
          final body = message.notification?.body;
           SharedPreferences prefs = await SharedPreferences.getInstance();
           final String notificationData = json.encode({&quot;title&quot;:title,&quot;body&quot;:body});
           final setData =  detail.add(notificationData);
          prefs.setString('notificationData', setData);
          print(notificationData);
          print(setData);
        }
  </code></pre>