<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[100 days of dart]]></title><description><![CDATA[100 days of dart]]></description><link>https://faithydev.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Wed, 07 Oct 2026 16:43:36 GMT</lastBuildDate><atom:link href="https://faithydev.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Day 16 of 100 Days of Code: Practising Everything in Collections]]></title><description><![CDATA[Today, I spent the whole day practising everything I’ve learned about collections in Dart: lists, sets, and maps. After learning their definitions and features, I wanted to make sure I could use them comfortably in real programs. I didn’t want to jus...]]></description><link>https://faithydev.hashnode.dev/day-16-of-100-days-of-code-practising-everything-in-collections</link><guid isPermaLink="true">https://faithydev.hashnode.dev/day-16-of-100-days-of-code-practising-everything-in-collections</guid><category><![CDATA[Dart]]></category><category><![CDATA[#dart-for-beginners]]></category><category><![CDATA[dart programming tutorial]]></category><category><![CDATA[#dart language]]></category><category><![CDATA[Flutter]]></category><category><![CDATA[flutter]]></category><category><![CDATA[software development]]></category><category><![CDATA[coding]]></category><category><![CDATA[coding journey]]></category><category><![CDATA[coding tips]]></category><category><![CDATA[#codingNewbies]]></category><category><![CDATA[Coding for beginners]]></category><dc:creator><![CDATA[fathia olusegun]]></dc:creator><pubDate>Mon, 06 Oct 2025 04:21:45 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1759723793296/a33160b3-c045-4070-a96b-c8daed3bf6ef.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Today, I spent the whole day <strong>practising everything I’ve learned about collections in Dart:</strong> lists, sets, and maps. After learning their definitions and features, I wanted to make sure I could use them comfortably in real programs. I didn’t want to just memorize; I wanted to understand how they work together in real use cases.</p>
<p>When I started this morning, I opened my code editor, created a new Dart file, and began experimenting. I told myself, “No new topics today, only practice.”</p>
<h3 id="heading-lists">Lists</h3>
<p>I began with <strong>lists</strong>, the most familiar of all. Lists are ordered, allow duplicates, and are great for storing groups of data. I created different types of lists, one with strings, another with integers, and even one with mixed data.</p>
<p>I practiced adding new items with <code>.add()</code> and <code>.insert()</code>, updating elements using their index, and removing elements using <code>.remove()</code> and <code>.removeAt()</code>. Then, I tried sorting and reversing lists to better understand how Dart organises data.</p>
<p>Here’s one of my exercises:</p>
<pre><code class="lang-dart"><span class="hljs-built_in">List</span>&lt;<span class="hljs-built_in">int</span>&gt; numbers = [<span class="hljs-number">5</span>, <span class="hljs-number">3</span>, <span class="hljs-number">9</span>, <span class="hljs-number">1</span>, <span class="hljs-number">5</span>];
numbers.sort();
<span class="hljs-built_in">print</span>(numbers); <span class="hljs-comment">// [1, 3, 5, 5, 9]</span>
<span class="hljs-built_in">print</span>(numbers.reversed.toList()); <span class="hljs-comment">// [9, 5, 5, 3, 1]</span>
</code></pre>
<p>This simple test showed me how easy it is to control data flow in Dart. I also noticed that lists are perfect when you care about order, like when displaying items in a certain sequence or saving scores by round.</p>
<h3 id="heading-sets">Sets</h3>
<p>After that, I moved on to <strong>sets</strong>. At first, sets felt a lot like lists, but then I realised how unique they are. Sets do not allow duplicates, and they don’t keep order. They’re great when you only want unique values.</p>
<p>I created a few sets and played with operations like adding, removing, and comparing them. What really stood out were the <strong>set operations:</strong> <code>union</code>, <code>intersection</code>, and <code>difference</code>. These are extremely powerful when working with data comparisons.</p>
<p>Here’s an example I ran:</p>
<pre><code class="lang-dart"><span class="hljs-built_in">Set</span>&lt;<span class="hljs-built_in">int</span>&gt; setA = {<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>};
<span class="hljs-built_in">Set</span>&lt;<span class="hljs-built_in">int</span>&gt; setB = {<span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>, <span class="hljs-number">6</span>};
</code></pre>
<pre><code class="lang-dart"><span class="hljs-built_in">print</span>(setA.union(setB));        <span class="hljs-comment">// {1, 2, 3, 4, 5, 6}</span>
<span class="hljs-built_in">print</span>(setA.intersection(setB)); <span class="hljs-comment">// {3, 4}</span>
<span class="hljs-built_in">print</span>(setA.difference(setB));   <span class="hljs-comment">// {1, 2}</span>
</code></pre>
<p>I could clearly see how sets can be used for filtering unique data or finding shared items between two groups. They’re also faster to search through than lists, especially when dealing with large amounts of data.</p>
<h3 id="heading-maps">Maps</h3>
<p>Finally, I spent the rest of my time working on <strong>maps</strong>. Maps are like little dictionaries in Dart. Each item is stored as a <strong>key-value pair</strong>, where the key must be unique.</p>
<p>Maps are great when you need to link one piece of data to another, like names to scores, product IDs to details, or countries to their capitals.</p>
<p>Here’s one of my practice codes:</p>
<pre><code class="lang-dart"><span class="hljs-built_in">Map</span>&lt;<span class="hljs-built_in">String</span>, <span class="hljs-built_in">int</span>&gt; scores = {
  <span class="hljs-string">'Alice'</span>: <span class="hljs-number">90</span>,
  <span class="hljs-string">'Bob'</span>: <span class="hljs-number">85</span>,
  <span class="hljs-string">'Clara'</span>: <span class="hljs-number">92</span>
};
</code></pre>
<pre><code class="lang-dart">scores[<span class="hljs-string">'David'</span>] = <span class="hljs-number">88</span>;  <span class="hljs-comment">// Add a new entry</span>
scores[<span class="hljs-string">'Alice'</span>] = <span class="hljs-number">95</span>;  <span class="hljs-comment">// Update Alice's score</span>
</code></pre>
<pre><code class="lang-dart">scores.forEach((key, value) {
  <span class="hljs-built_in">print</span>(<span class="hljs-string">'<span class="hljs-subst">$key</span> scored <span class="hljs-subst">$value</span>'</span>);
});
</code></pre>
<p>I loved how easy it was to loop through a map and access both keys and values. It felt like working with JSON data, which means this concept will be super useful later when I start handling APIs or saving user data.</p>
<p>To test myself, I tried a small program that used <strong>lists, sets, and maps together</strong>.</p>
<p>Here’s what I did:</p>
<ul>
<li><p>I stored names in a list.</p>
</li>
<li><p>I converted that list into a set to remove duplicates.</p>
</li>
<li><p>Then I created a map that linked each unique name to a score.</p>
</li>
</ul>
<pre><code class="lang-dart"><span class="hljs-built_in">List</span>&lt;<span class="hljs-built_in">String</span>&gt; names = [<span class="hljs-string">'Alice'</span>, <span class="hljs-string">'Bob'</span>, <span class="hljs-string">'Alice'</span>, <span class="hljs-string">'Clara'</span>];
<span class="hljs-built_in">Set</span>&lt;<span class="hljs-built_in">String</span>&gt; uniqueNames = names.toSet();
</code></pre>
<pre><code class="lang-dart"><span class="hljs-built_in">Map</span>&lt;<span class="hljs-built_in">String</span>, <span class="hljs-built_in">int</span>&gt; scoreMap = {};
<span class="hljs-built_in">int</span> score = <span class="hljs-number">80</span>;
</code></pre>
<pre><code class="lang-dart"><span class="hljs-keyword">for</span> (<span class="hljs-keyword">var</span> name <span class="hljs-keyword">in</span> uniqueNames) {
  scoreMap[name] = score;
  score += <span class="hljs-number">5</span>;
}
</code></pre>
<pre><code class="lang-dart"><span class="hljs-built_in">print</span>(scoreMap);
</code></pre>
<p>Output:</p>
<pre><code class="lang-dart">{Alice: <span class="hljs-number">80</span>, Bob: <span class="hljs-number">85</span>, Clara: <span class="hljs-number">90</span>}
</code></pre>
<p>This simple practice made me see how all three collections can work together to solve real problems, clean data, organise it, and give it meaning.</p>
<p>Today was not about learning something new, but about <strong>building confidence</strong> in what I’ve already learned. Practicing lists, sets, and maps helped me understand the differences between them:</p>
<ul>
<li><p><strong>Lists</strong> are for ordered data.</p>
</li>
<li><p><strong>Sets</strong> are for unique items.</p>
</li>
<li><p><strong>Maps</strong> are for key-value pairs.</p>
</li>
</ul>
<p>Each one has its own use, and now I can easily decide which to use depending on the problem I’m solving.</p>
<h3 id="heading-next-step">Next Step</h3>
<p>Tomorrow, I’ll start exploring more advanced concepts, maybe higher-order functions, collection methods, or even working with data transformations in Dart. I’m proud of how far I’ve come in just 16 days. Each step makes Dart feel easier and more natural.</p>
<h2 id="heading-join-me"><strong>Join Me!</strong></h2>
<p>I’ll be sharing my progress every week here on Hashnode.</p>
<p>You can connect with me on <a target="_blank" href="https://x.com/faithy_io">Twitter(X)</a>, <a target="_blank" href="https://www.instagram.com/faithydev_?igsh=MTFoaWtnaXhwMHhmMQ%3D%3D&amp;utm_source=qr">Instagram</a>, <a target="_blank" href="https://www.linkedin.com/in/fathia-olusegun-54b546240?utm_source=share&amp;utm_campaign=share_via&amp;utm_content=profile&amp;utm_medium=ios_app">Linkedin</a>, and <a target="_blank" href="https://www.facebook.com/share/173Hgnwfux/?mibextid=wwXIfr">Facebook</a>.</p>
<p>If you’re also learning Dart or Flutter, let’s connect . I’d love to learn together!</p>
<p>the previous days are available my <a target="_blank" href="https://medium.com/@fathiaolusegun">medium</a>.</p>
]]></content:encoded></item></channel></rss>