<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Gichira</title>
    <description>The latest articles on DEV Community by Gichira (@edwin_gichira_92748e19bb6).</description>
    <link>https://dev.to/edwin_gichira_92748e19bb6</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1613961%2F486ad758-f962-46b3-8654-a4bf76634e72.png</url>
      <title>DEV Community: Gichira</title>
      <link>https://dev.to/edwin_gichira_92748e19bb6</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/edwin_gichira_92748e19bb6"/>
    <language>en</language>
    <item>
      <title>Flutter Architecture Explained: What Every Beginner Needs to Know</title>
      <dc:creator>Gichira</dc:creator>
      <pubDate>Tue, 16 Jun 2026 21:10:49 +0000</pubDate>
      <link>https://dev.to/edwin_gichira_92748e19bb6/flutter-architecture-explained-what-every-beginner-needs-to-know-1oim</link>
      <guid>https://dev.to/edwin_gichira_92748e19bb6/flutter-architecture-explained-what-every-beginner-needs-to-know-1oim</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk4rsliantknm6m0rtbdt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk4rsliantknm6m0rtbdt.png" alt=" " width="800" height="457"&gt;&lt;/a&gt;&lt;br&gt;
If you're just getting started with Flutter, you'll write your first widget within minutes. But somewhere around day three, you'll hit a wall — why does &lt;code&gt;context&lt;/code&gt; crash here? Why did my whole screen rebuild when I changed one variable? Why does Flutter feel so different from React Native or SwiftUI?&lt;/p&gt;

&lt;p&gt;The answer is architecture. Once you understand how Flutter actually works under the hood, everything else clicks into place. This is &lt;strong&gt;Part 1&lt;/strong&gt; of the &lt;em&gt;Flutter From Zero&lt;/em&gt; series, and we're covering the foundations.&lt;/p&gt;


&lt;h2&gt;
  
  
  What Is Flutter — and Why Does It Exist?
&lt;/h2&gt;

&lt;p&gt;Flutter is an open-source UI toolkit from Google that lets you build natively compiled apps for &lt;strong&gt;six platforms&lt;/strong&gt; from a single Dart codebase: Android, iOS, Web, Windows, macOS, and Linux.&lt;/p&gt;

&lt;p&gt;But here's what makes it different from every other cross-platform tool:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Flutter doesn't use native UI components. It draws its own UI using a custom rendering engine.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That's a big deal. Tools like React Native translate your code into native components — so a &lt;code&gt;&amp;lt;Button&amp;gt;&lt;/code&gt; becomes an Android &lt;code&gt;Button&lt;/code&gt; or an iOS &lt;code&gt;UIButton&lt;/code&gt;. Flutter skips that entirely and paints pixels directly to the screen using its own engine (Skia or the newer Impeller). The result: pixel-perfect UI that looks identical on every platform, and no JavaScript bridge slowing things down.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Problem&lt;/th&gt;
&lt;th&gt;Flutter's Solution&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Separate iOS/Android codebases&lt;/td&gt;
&lt;td&gt;One Dart codebase for all platforms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bridge overhead (React Native)&lt;/td&gt;
&lt;td&gt;No bridge — renders directly&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Inconsistent UI per platform&lt;/td&gt;
&lt;td&gt;Flutter draws its own widgets&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Slow cross-platform performance&lt;/td&gt;
&lt;td&gt;Compiles to native ARM machine code&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Flutter 1.0 shipped in December 2018. By Flutter 3.x, it targets six platforms stably.&lt;/p&gt;


&lt;h2&gt;
  
  
  The 3 Layers of Flutter
&lt;/h2&gt;

&lt;p&gt;Flutter's architecture is a three-layer sandwich. Each layer depends on the one below it. You work in the top layer and rarely touch the others — but knowing what they do changes how you debug and optimize.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──────────────────────────────────────────┐
│        FRAMEWORK LAYER  (Dart)           │
│  Material / Cupertino / Widgets / ...    │
├──────────────────────────────────────────┤
│          ENGINE LAYER  (C++)             │
│    Skia / Impeller / Dart Runtime        │
├──────────────────────────────────────────┤
│        EMBEDDER LAYER  (Platform)        │
│  Android / iOS / Windows / macOS ...     │
└──────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  1. Framework Layer (Dart)
&lt;/h3&gt;

&lt;p&gt;This is where you spend 95% of your time. It's written entirely in Dart and contains everything you interact with: widgets, routing, theming, gestures, and animations.&lt;/p&gt;

&lt;p&gt;The sub-layers stack like this, bottom to top:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Material / Cupertino    ← Design-system widgets (buttons, dialogs, etc.)
Widgets                 ← Core primitives (StatelessWidget, StatefulWidget)
Rendering               ← RenderObjects, layout, paint
Animation / Painting    ← Curves, tweens, Canvas API
Foundation              ← Utilities, diagnostics, change notifiers
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Engine Layer (C++)
&lt;/h3&gt;

&lt;p&gt;The engine is Flutter's heart. You never write C++, but this layer is doing the heavy lifting:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Skia / Impeller&lt;/strong&gt; — renders pixels to the screen&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dart Runtime&lt;/strong&gt; — runs your Dart code (AOT in release builds, JIT in debug)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Platform Channels&lt;/strong&gt; — lets Dart talk to native code&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Text Layout&lt;/strong&gt; — handles fonts and text shaping&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Quick note on &lt;strong&gt;Impeller&lt;/strong&gt;: it's Flutter's newer renderer, designed to eliminate shader-compilation jank (that stutter you feel the first time a new animation runs). It's now the default on iOS and rolling out on Android.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Embedder Layer (Platform-specific)
&lt;/h3&gt;

&lt;p&gt;The embedder is what makes Flutter runnable on a given OS. It's written in the host platform's language (Kotlin for Android, Swift for iOS, C++ for Desktop).&lt;/p&gt;

&lt;p&gt;Its job: create a Flutter Engine instance, give it a surface to draw on, and feed it input events (touch, keyboard, mouse). Because this layer is separated out, Flutter can run on custom hardware — anyone can write a custom embedder.&lt;/p&gt;




&lt;h2&gt;
  
  
  The 3 Trees and the Rendering Pipeline
&lt;/h2&gt;

&lt;p&gt;This is the part that trips up most beginners. Flutter manages &lt;strong&gt;three parallel trees&lt;/strong&gt; to render your UI efficiently.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Your Code
    │
    ▼
┌─────────────┐
│ Widget Tree │  ← Immutable blueprints (cheap to create)
└──────┬──────┘
       │ inflate
       ▼
┌─────────────┐
│ Element Tree│  ← Mutable, long-lived (lifecycle manager)
└──────┬──────┘
       │ creates
       ▼
┌─────────────┐
│ Render Tree │  ← Does the actual layout and painting (expensive)
└─────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Widget Tree&lt;/strong&gt; — Widgets are immutable Dart objects. Think of them as configuration blueprints. Every time &lt;code&gt;build()&lt;/code&gt; runs, new widgets are created. This sounds wasteful, but widgets are intentionally cheap and lightweight.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Element Tree&lt;/strong&gt; — Elements are long-lived and mutable. When Flutter first renders a widget, it creates an Element for it. That Element &lt;em&gt;persists across rebuilds&lt;/em&gt; — it holds the connection between the widget (config) and the render object (output).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;When you call &lt;code&gt;setState()&lt;/code&gt;, Flutter marks the Element dirty and schedules a rebuild. It does NOT recreate the Element or RenderObject from scratch unless the widget type changes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Render Tree&lt;/strong&gt; — RenderObjects do the real work: computing sizes, calculating positions, and painting pixels. This tree is expensive to create, so Flutter reuses RenderObjects as aggressively as possible.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Render Pipeline
&lt;/h3&gt;

&lt;p&gt;Each frame goes through five stages:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Build → Layout → Paint → Composite → Rasterize
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Build&lt;/strong&gt; — &lt;code&gt;build()&lt;/code&gt; is called on dirty widgets; new widget nodes are produced&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Layout&lt;/strong&gt; — RenderObjects compute sizes and positions using constraints&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Paint&lt;/strong&gt; — RenderObjects draw onto a Canvas&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Composite&lt;/strong&gt; — Layers are assembled into a scene&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rasterize&lt;/strong&gt; — The GPU converts the scene to pixels on screen&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Flutter targets 60fps (16.6ms per frame) or 120fps on capable hardware. The three-tree model is what makes that possible — only dirty parts of the tree get rebuilt, not the entire UI.&lt;/p&gt;




&lt;h2&gt;
  
  
  Project Structure
&lt;/h2&gt;

&lt;p&gt;Running &lt;code&gt;flutter create my_app&lt;/code&gt; produces this layout:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="s"&gt;my_app/&lt;/span&gt;
&lt;span class="s"&gt;├── lib/              ← Your Dart code lives here&lt;/span&gt;
&lt;span class="s"&gt;│   └── main.dart     ← Entry point&lt;/span&gt;
&lt;span class="s"&gt;├── android/          ← Android embedder + native code&lt;/span&gt;
&lt;span class="s"&gt;├── ios/              ← iOS embedder + native code&lt;/span&gt;
&lt;span class="s"&gt;├── web/              ← Web embedder&lt;/span&gt;
&lt;span class="s"&gt;├── windows/&lt;/span&gt;
&lt;span class="s"&gt;├── macos/&lt;/span&gt;
&lt;span class="s"&gt;├── linux/&lt;/span&gt;
&lt;span class="s"&gt;├── assets/           ← Images, fonts, JSON, etc.&lt;/span&gt;
&lt;span class="s"&gt;├── test/             ← Unit and widget tests&lt;/span&gt;
&lt;span class="s"&gt;└── pubspec.yaml      ← Project manifest&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A recommended structure for real apps inside &lt;code&gt;lib/&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="s"&gt;lib/&lt;/span&gt;
&lt;span class="s"&gt;├── main.dart&lt;/span&gt;
&lt;span class="s"&gt;├── app.dart               ← Root widget + routing&lt;/span&gt;
&lt;span class="s"&gt;├── features/              ← Feature-based folders&lt;/span&gt;
&lt;span class="s"&gt;│   ├── home/&lt;/span&gt;
&lt;span class="s"&gt;│   └── auth/&lt;/span&gt;
&lt;span class="s"&gt;├── shared/                ← Reusable widgets, utils&lt;/span&gt;
&lt;span class="s"&gt;└── data/                  ← Models, APIs, repositories&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  pubspec.yaml
&lt;/h3&gt;

&lt;p&gt;This is your project's manifest — it declares dependencies, assets, and fonts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;my_app&lt;/span&gt;
&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;1.0.0+1&lt;/span&gt;

&lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;sdk&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;&amp;gt;=3.0.0&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;lt;4.0.0"&lt;/span&gt;

&lt;span class="na"&gt;dependencies&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;flutter&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;sdk&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;flutter&lt;/span&gt;
  &lt;span class="na"&gt;http&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;^1.2.0&lt;/span&gt;

&lt;span class="na"&gt;flutter&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;assets&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;assets/images/&lt;/span&gt;
  &lt;span class="na"&gt;fonts&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;family&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Poppins&lt;/span&gt;
      &lt;span class="na"&gt;fonts&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;asset&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;assets/fonts/Poppins-Regular.ttf&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;asset&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;assets/fonts/Poppins-Bold.ttf&lt;/span&gt;
          &lt;span class="na"&gt;weight&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;700&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After any edit to &lt;code&gt;pubspec.yaml&lt;/code&gt;, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;flutter pub get
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  App Lifecycle
&lt;/h2&gt;

&lt;p&gt;Flutter exposes lifecycle events via &lt;code&gt;WidgetsBindingObserver&lt;/code&gt;. Understanding this is critical when you work with cameras, audio, network connections, or local storage.&lt;/p&gt;

&lt;h3&gt;
  
  
  The States
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;detached → inactive → resumed ↔ hidden / paused → detached
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;resumed&lt;/strong&gt; — app is fully active in the foreground ✅&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;inactive&lt;/strong&gt; — visible but not receiving input (e.g., incoming call overlay)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;hidden&lt;/strong&gt; — not visible but not suspended (added in Flutter 3.13)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;paused&lt;/strong&gt; — fully backgrounded / suspended&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;detached&lt;/strong&gt; — engine alive, no view attached (startup or shutdown)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Listening to Lifecycle Events
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;_MyScreenState&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;State&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;MyScreen&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;WidgetsBindingObserver&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="nd"&gt;@override&lt;/span&gt;
  &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;initState&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;super&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;initState&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="n"&gt;WidgetsBinding&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;instance&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;addObserver&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nd"&gt;@override&lt;/span&gt;
  &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;dispose&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;WidgetsBinding&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;instance&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;removeObserver&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// ALWAYS unregister&lt;/span&gt;
    &lt;span class="k"&gt;super&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;dispose&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nd"&gt;@override&lt;/span&gt;
  &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;didChangeAppLifecycleState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;AppLifecycleState&lt;/span&gt; &lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;switch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="n"&gt;AppLifecycleState&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;resumed&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
        &lt;span class="c1"&gt;// Resume camera, refresh data&lt;/span&gt;
        &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="n"&gt;AppLifecycleState&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;paused&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
        &lt;span class="c1"&gt;// Save state, release resources&lt;/span&gt;
        &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;default&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  BuildContext — The Part That Confuses Everyone
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;BuildContext&lt;/code&gt; is a handle to your widget's &lt;strong&gt;location in the Widget Tree&lt;/strong&gt;. Under the hood, it's the Element itself.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="nd"&gt;@override&lt;/span&gt;
&lt;span class="n"&gt;Widget&lt;/span&gt; &lt;span class="nf"&gt;build&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BuildContext&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;theme&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Theme&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;of&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;          &lt;span class="c1"&gt;// walks UP the tree to find ThemeData&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;size&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;MediaQuery&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;of&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;size&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;Container&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nl"&gt;color:&lt;/span&gt; &lt;span class="n"&gt;theme&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;colorScheme&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;primary&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you call &lt;code&gt;Theme.of(context)&lt;/code&gt;, Flutter walks up the Element Tree to find the nearest &lt;code&gt;Theme&lt;/code&gt; ancestor. Your widget then &lt;em&gt;subscribes&lt;/em&gt; to that theme — it rebuilds automatically when the theme changes.&lt;/p&gt;

&lt;h3&gt;
  
  
  The 4 Mistakes to Avoid
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;❌ Using context across an async gap&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="c1"&gt;// WRONG&lt;/span&gt;
&lt;span class="nl"&gt;onPressed:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="kd"&gt;async&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;Future&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;delayed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Duration&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nl"&gt;seconds:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
  &lt;span class="n"&gt;Navigator&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;of&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;pop&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// context may be stale!&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// CORRECT&lt;/span&gt;
&lt;span class="nl"&gt;onPressed:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="kd"&gt;async&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;Future&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;delayed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Duration&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nl"&gt;seconds:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;mounted&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;          &lt;span class="c1"&gt;// guard check first&lt;/span&gt;
  &lt;span class="n"&gt;Navigator&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;of&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;pop&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;❌ Using context in initState()&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="c1"&gt;// WRONG — widget isn't in the tree yet&lt;/span&gt;
&lt;span class="nd"&gt;@override&lt;/span&gt;
&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;initState&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;super&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;initState&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;theme&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Theme&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;of&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// CRASH&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// CORRECT — use didChangeDependencies() instead&lt;/span&gt;
&lt;span class="nd"&gt;@override&lt;/span&gt;
&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;didChangeDependencies&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;super&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;didChangeDependencies&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;theme&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Theme&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;of&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// ✅&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;❌ Wrong context level for Scaffold&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="c1"&gt;// CORRECT — use Builder to get a context below the Scaffold&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;Scaffold&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nl"&gt;body:&lt;/span&gt; &lt;span class="n"&gt;Builder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nl"&gt;builder:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;innerContext&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;ElevatedButton&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="nl"&gt;onPressed:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="n"&gt;ScaffoldMessenger&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;of&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;innerContext&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;showSnackBar&lt;/span&gt;&lt;span class="p"&gt;(...);&lt;/span&gt; &lt;span class="c1"&gt;// ✅&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;❌ Storing context as a field&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="c1"&gt;// WRONG — stored context goes stale after rebuilds or navigation&lt;/span&gt;
&lt;span class="n"&gt;BuildContext&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;savedContext&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Quick Cheat Sheet
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Flutter Architecture
│
├── 3 Layers
│   ├── Framework (Dart)   — what you write
│   ├── Engine (C++)       — renders, runs Dart
│   └── Embedder (Native)  — platform window/surface
│
├── 3 Trees
│   ├── Widget Tree        — immutable blueprints
│   ├── Element Tree       — mutable, manages lifecycle
│   └── Render Tree        — layout + paint (expensive)
│
├── Render Pipeline
│   Build → Layout → Paint → Composite → Rasterize
│
├── Lifecycle
│   detached → inactive → resumed ↔ paused/hidden
│
└── BuildContext Rules
    ✅ Use in build(), didChangeDependencies()
    ✅ Check mounted after async gaps
    ❌ Never in initState() directly
    ❌ Never store long-term
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  What's Next?
&lt;/h2&gt;

&lt;p&gt;In &lt;strong&gt;Part 2&lt;/strong&gt;, we'll dive into &lt;code&gt;StatelessWidget&lt;/code&gt; vs &lt;code&gt;StatefulWidget&lt;/code&gt;, when to use each, and how state actually flows through a Flutter app.&lt;/p&gt;

&lt;p&gt;If this helped you, drop a ❤️ or leave a comment with questions — I read every one. Follow the &lt;em&gt;Flutter From Zero&lt;/em&gt; series so you don't miss the next post.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Written for Flutter 3.x | Dart SDK 3.0+&lt;/em&gt;&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>dart</category>
      <category>beginners</category>
      <category>mobile</category>
    </item>
    <item>
      <title>`npm fund`</title>
      <dc:creator>Gichira</dc:creator>
      <pubDate>Mon, 11 May 2026 23:06:37 +0000</pubDate>
      <link>https://dev.to/edwin_gichira_92748e19bb6/npm-fund-1ch9</link>
      <guid>https://dev.to/edwin_gichira_92748e19bb6/npm-fund-1ch9</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;166 packages are looking for funding
run `npm fund` for details
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I remember when I first saw this message in my terminal, I completely misunderstood it.&lt;/p&gt;

&lt;p&gt;I thought “packages looking for funding” was just another weird developer phrase that meant something highly technical underneath. Surely it couldn’t literally mean funding... right?&lt;/p&gt;

&lt;p&gt;Turns out, it did.&lt;/p&gt;

&lt;p&gt;It simply meant that the maintainers behind some of the open-source packages I was using had added sponsorship links so developers could support their work financially.&lt;/p&gt;

&lt;p&gt;That’s it.&lt;/p&gt;

&lt;p&gt;Now every time I see this message appear after an install, I quietly laugh to myself. It reminds me how easy it is, especially in tech, to overcomplicate simple things just because we assume everything has some deeper technical meaning behind it.&lt;/p&gt;

&lt;p&gt;Sometimes the message really is just the message.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fawjif8oy9k4uqy7uticv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fawjif8oy9k4uqy7uticv.png" alt=" " width="491" height="93"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>npm</category>
      <category>jokes</category>
      <category>devops</category>
      <category>coding</category>
    </item>
    <item>
      <title>Automatic Windows Resync time after reboot: Auto Clock Sync with Dead CMOS and Battery.</title>
      <dc:creator>Gichira</dc:creator>
      <pubDate>Wed, 12 Jun 2024 09:38:42 +0000</pubDate>
      <link>https://dev.to/edwin_gichira_92748e19bb6/fixing-laptop-time-issues-solving-clock-problems-with-dead-cmos-and-battery-8ef</link>
      <guid>https://dev.to/edwin_gichira_92748e19bb6/fixing-laptop-time-issues-solving-clock-problems-with-dead-cmos-and-battery-8ef</guid>
      <description>&lt;h2&gt;
  
  
  OPTION 1. &lt;em&gt;Most viable solution 💯&lt;/em&gt;.
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Open Task Scheduler:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Press  Win + R  to open the Run dialog.&lt;/p&gt;

&lt;p&gt;Type  &lt;em&gt;taskschd.msc&lt;/em&gt;  and press Enter.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Create a new task:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Click on &lt;em&gt;"Actions"&lt;/em&gt; tab then click either &lt;em&gt;"Create Basic Task..."&lt;/em&gt; or &lt;em&gt;"Create Task"&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Set up the task:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Name it something like "&lt;em&gt;Time Sync on Startup&lt;/em&gt;".&lt;/p&gt;

&lt;p&gt;Under the &lt;em&gt;Triggers&lt;/em&gt; tab, click &lt;em&gt;New&lt;/em&gt; then select when to begin the task as "At startup", and click &lt;em&gt;OK&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;For Action under the action tab, select "Start a program".&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Specify program/script:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the Program/script field, type &lt;code&gt;w32tm&lt;/code&gt;. In Add arguments (optional), type &lt;code&gt;/resync&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The final setup should look something like this:&lt;/p&gt;

&lt;p&gt;Program/script: &lt;code&gt;w32tm&lt;/code&gt;Add arguments (optional): &lt;code&gt;/resync&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This tells Windows to use its &lt;strong&gt;built-in time synchronization command&lt;/strong&gt; (w32tm /resync) whenever your laptop starts.&lt;/p&gt;

&lt;p&gt;Click Finish or Ok depending on whether you selected to create a Basic task or a Task.&lt;/p&gt;

&lt;h2&gt;
  
  
  OPTION 2
&lt;/h2&gt;

&lt;p&gt;Not a fully viable solution due to some access level restrictions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Step 1: Create a PowerShell Script&lt;br&gt;
&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open Notepad or any text editor.&lt;/li&gt;
&lt;li&gt;Copy and paste the following PowerShell script into the text editor:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# PowerShell script to sync system time with an internet time server
Try {
    Write-Output "Updating system time from time.windows.com..."

    # Start the Windows Time service if it is not running
    $service = Get-Service -Name w32time
    If ($service.Status -ne 'Running') {
        Start-Service -Name w32time
        Start-Sleep -Seconds 5  # Give the service time to start
    }

    # Update time using W32tm (Windows Time Service)
    w32tm /config /manualpeerlist:"time.windows.com" /syncfromflags:manual /reliable:YES /update
    Start-Sleep -Seconds 5  # Wait for a few seconds to ensure the configuration is updated
    w32tm /resync
    Write-Output "System time updated successfully."
} Catch {
    Write-Output "Failed to update system time."
    $_.Exception.Message
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save the file with a &lt;em&gt;.ps1&lt;/em&gt; extension, for example, &lt;em&gt;UpdateTime.ps1&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Step 2: Create a Scheduled Task&lt;br&gt;
&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open Task Scheduler:
Press &lt;em&gt;Windows + R&lt;/em&gt;, type &lt;em&gt;taskschd.msc&lt;/em&gt;, and press Enter.&lt;/li&gt;
&lt;li&gt;Create a New Task:
In the Task Scheduler, click Create Task in the Actions pane on the right.&lt;/li&gt;
&lt;li&gt;General Tab:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Name your task, e.g., "&lt;em&gt;Update System Time on Startup&lt;/em&gt;".&lt;br&gt;
Choose "&lt;em&gt;Run whether the user is logged on or not&lt;/em&gt;".&lt;br&gt;
Check "&lt;em&gt;Run with highest privileges&lt;/em&gt;".&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Triggers Tab:&lt;br&gt;
Click New to create a new trigger.&lt;br&gt;
From the Begin the task dropdown menu, select "At startup".&lt;br&gt;
Click OK to save the trigger.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Actions Tab:&lt;br&gt;
Click _New _to create a new action.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;From the Action dropdown menu, select "&lt;em&gt;Start a program&lt;/em&gt;".&lt;/p&gt;

&lt;p&gt;In the Program/script box, type &lt;em&gt;powershell.exe&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;In the Add arguments (optional) box, type the following (replace the path with the path to your script):&lt;/p&gt;

&lt;p&gt;&lt;em&gt;powershell&lt;/em&gt;&lt;br&gt;
&lt;code&gt;-File "C:\autoTimebyEd\UpdateTime.ps1"&lt;/code&gt;&lt;br&gt;
Click OK to save the action.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Conditions Tab:&lt;br&gt;
Uncheck "Start the task only if the computer is on AC power" if you want the task to run on battery power as well.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Settings Tab:&lt;br&gt;
Check "Allow task to be run on demand".&lt;br&gt;
Optionally, you can adjust other settings as needed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Save the Task:&lt;br&gt;
Click OK to save the task.&lt;br&gt;
You may be prompted to enter your user account password.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Testing the Task&lt;br&gt;
Run the Task Manually from the Task Scheduler:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In Task Scheduler, locate the task you created.&lt;br&gt;
Right-click the task and select "&lt;em&gt;Run&lt;/em&gt;".&lt;br&gt;
Check if the system time updates correctly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Restart Your Laptop:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Restart your laptop to ensure the script runs at startup and updates the time.
Following these steps, your laptop should automatically fetch and update the system time from &lt;em&gt;time.windows.com&lt;/em&gt; each time it powers on. 
This setup ensures your system clock is always accurate without requiring manual intervention.&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
  </channel>
</rss>
