title: How i can add a saved items to favorite section in Flutter?
body: <p>i am currently learning flutter and dart. I searched but couldn't find it.</p>
  <p>I want to put a favorite button next to the names in the list
  and
  when clicked on it, I just want it to sort the favorites on the other page.</p>
  <p>Here is my code:</p>
  <pre><code>import 'package:flutter/material.dart';
  
  void main() =&gt; runApp(MyApp());
  
  
  class MyApp extends StatelessWidget {
    const MyApp({Key? key}) : super(key: key);
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        home: HomeScreen(),
      );
    }
  }
  
  class HomeScreen extends StatefulWidget {
    AnaEkran createState() =&gt; AnaEkran();
  }
  
  
  class AnaEkran extends State&lt;HomeScreen&gt; {
    static List&lt;String&gt; mainDataList = [
      &quot;Apple&quot;,
      &quot;Apricot&quot;,
      &quot;Banana&quot;,
      &quot;Blackberry&quot;,
      &quot;Coconut&quot;,
      &quot;Date&quot;,
      &quot;Fig&quot;,
      &quot;Gooseberry&quot;,
      &quot;Grapes&quot;,
      &quot;Lemon&quot;,
      &quot;Litchi&quot;,
      &quot;Mango&quot;,
      &quot;Orange&quot;,
      &quot;Papaya&quot;,
      &quot;Peach&quot;,
      &quot;Pineapple&quot;,
      &quot;Pomegranate&quot;,
      &quot;Starfruit&quot;
    ];
    @override
    Widget build(BuildContext context) {
      return DefaultTabController(
        length: 2,
        child: Scaffold(
            appBar: AppBar(
              title: Text('NickName Generator'),
              backgroundColor: Colors.deepPurple,
              bottom: TabBar(
                tabs: [
                  Tab(icon: Icon(Icons.article_rounded)),
                  Tab(icon: Icon(Icons.favorite)),
                ],
              ),
            ),
            body: ListView.builder(
              itemCount: mainDataList.length,
              itemBuilder: (context, index) {
             return Card (
               child: Padding(
               padding: const EdgeInsets.all(20.0),
                  child: Text(mainDataList[index],style: TextStyle(fontSize: 19.0),),
  
               ),
  
          );
         },
        ),
      ),
      );
    }
  }
  </code></pre>
  <p>And this is how it looks. The same list appears on the second page, but I only want the favorite words to be added there.</p>
  <p><a href="https://i.stack.imgur.com/zAMmA.png" rel="nofollow noreferrer">first screen </a></p>
  <p><a href="https://i.stack.imgur.com/MiDer.png" rel="nofollow noreferrer">second screen</a></p>