Filter
Exclude
Time range
-
Near
🚀 Flutter Interview Question What's the difference between: ✅ StatelessWidget and ✅ StatefulWidget When would you choose one over the other? #Flutter #FlutterDev #MobileDevelopment
1
23
StatelessWidget vs StatefulWidget - when to actually use each? A simple rule: StatelessWidget→ no internal state changes StatefulWidget→ UI needs to react to data Example: The TextWidget in your banking app is a stateful widget. Check the table below for more. #Flutter #Dart
3
50
Flutter Widget vs SwiftUI View in 30 sec Core concept (SAME in both): UI = f(state) State changes → new UI → framework diffs → update. 🟦 FLUTTER APPROACH: StatelessWidget (no state): class Greeting extends StatelessWidget { final String name; Widget build(context) => Text('Hello, $name'); } StatefulWidget (has state): class Counter extends StatefulWidget { State<Counter> createState() => _CounterState(); } class _CounterState extends State<Counter> { int _count = 0; void _increment() { setState(() => _count ); // Must call setState } Widget build(context) => Text('$_count'); } 🟧 SWIFTUI APPROACH: No state needed (like StatelessWidget): struct Greeting: View { let name: String var body: some View { Text("Hello, \(name)") } } With @State (like StatefulWidget): struct Counter: View { @State private var count = 0 var body: some View { Button("Count: \(count)") { count = 1 // Auto-updates, no setState needed } } } 🔑 KEY DIFFERENCES: 1️⃣ Class vs Struct Flutter: Classes (StatefulWidget State class) SwiftUI: Structs only (View is struct) 2️⃣ State location Flutter: Separate State class SwiftUI: Inline @State property 3️⃣ Triggering updates Flutter: Must call setState() SwiftUI: Automatic on @State change 4️⃣ Lifecycle Flutter: initState(), dispose() SwiftUI: .onAppear { }, .onDisappear { } ⚖️ TRADE-OFFS: Flutter pros: ✅ More control (setState timing) ✅ Explicit lifecycle methods ✅ Clear separation (Widget vs State) SwiftUI pros: ✅ Less boilerplate ✅ Auto-updates (no setState forgetting) ✅ No mounted checks needed Same mental model. Different syntax. #flutter #swift #ios #dart #swiftui
1
1
40
⚡ الفرق بين StatelessWidget و StatefulWidget في Flutter StatelessWidget واجهة ثابتة لا تتغير بعد البناء. StatefulWidget واجهة يمكن أن تتغير أثناء تشغيل التطبيق. مثال: عداد يزيد عند الضغط على زر → يحتاج StatefulWidget. #Flutter #Dart #FlutterDev
1
17
【FlutterのWidget6】 ▼StatelessWidgetの特徴 ・状態を持たない ・buildメソッドをオーバーライドし、1つ以上のウィジェットを組み合わせUIを構成 ・自身で表示更新できない ・パフォーマンスが高い ・1クラスで完結 ・シンプル構造 #個人開発
9
183
【FlutterのWidget3】 ▼独自のStatelessWidgetを定義 ・StatelessWidgetを継承したクラスを作成する事で共通化出来て実装がシンプルになる ・コンストラクタの第一引数のKeyは省略可 #個人開発
5
153
【FlutterのWidget2】 ▼状態を持たないWidget(StatelessWidget) ・Columnで垂直なレイアウトにする ・Children配列(childの複数形)で複数の要素を追加できる #個人開発
4
80
【FlutterのWidget】 ▼Hello Worldの表示 ・importの行はパッケージからライブラリに定義されたクラスや関数を利用可能にする ・ウィジェットは2つのクラスに分類できる →状態を持たないStatelessWidgetと状態を持つStateWidget #個人開発
8
200
Jan 14
crank.js.org/blog/why-be-rea… 原文を読んだ上での感想だが、Flutter の StatefulWidget, StatelessWidget, Widget Tree, Element Tree によるリアクティブで超効率的なレンダリングと、ValueNotifier, ChangeNotifier による明示的な変更通知システムは、はじめから非常に完成度が高い、とあらためて思った
なぜリアクティブが主流かもう少し考えたほうがいい リアクティブを余計な複雑性だと切り捨てて無いほうがシンプルなんだと信じるのはいいが、それは汚いものに蓋をするように複雑性の考慮やハンドリングをユーザーに丸投げしているだけなのだ qiita.com/rana_kualu/items/d…
1
7
585
Day 1 of 100 ✅ project 1 of 80 ✅ Key learnings: - StatefulWidget vs StatelessWidget - How setState() triggers UI rebuilds - Widget composition (Expanded, Column, Row) - String parsing and state management
Story Time…. 🍿 2026 is going to be a crazy good movie….. Amen!! 🙏
1
4
9
212
كنت فاكر نفسي ماشي صح في Flutter… لحد ما الكود بدأ يضرب مني يمين وشمال 🙆🏻‍♂️ أوقات كتير وإنت بتتعلم حاجة جديدة، بتحس إنك ماشي تمام… لحد ما تكتشف إنك بتمشي في سكة غلط من غير ما تاخد بالك. انا بقا في رحلتي مع Flutter، وقعت في شوية أخطاء غريبة، وحقيقي لما فهمتها وتعلمت منها، طريقتي في كتابة الكود اختلفت تمامًا. فـ حبيت أشاركم أهم الأخطاء اللي كنت بعملها في البداية، يمكن تفيد حد لسه بيبدأ👇🏻 ⛔ كل حاجة StatefulWidget! كنت بعمل كل الصفحات StatefulWidget حتى لو مش محتاجة. بعد كده فهمت إن استخدام StatelessWidget في الحالات البسيطة أخف وأنضف، وبيقلل من تعقيد الكود. ⛔ تجاهل الـ State Management في الأول كنت بستخدم setState في كل حاجة، وكنت بعمل Mess في الـ UI. بدأت أتعلم عن Provider وبعده جربت Riverpod وGetX… فرقوا معايا جدًا وخليوني أتحكم في الـ State بشكل منظم ومرن. ⛔ الكود كله في ملف واحد كنت بحط الـ UI والـ Logic في نفس الملف، وده خلّى الكود كابوس في أي تعديل. دلوقتي بقيت أقسم كل جزء في ملفه (Widgets / Screens / Services...) والكود بقى أسهل في القراءة والتعديل. ⛔ ماكنتش بفصل بين الـ Logic و الـ UI كنت بكتب كل حاجة جوه الـ build method. بدأت أستخدم MVVM وده خلاني أكتب كود أنضف وأسهل في التستنج. ⛔ تجاهلت كتابة الـ null safety في البداية مكنتش فاهم يعني إيه ? و!، وكنت بسيب المتغيرات مفتوحة كده وخلاص. بس لما الكود بدأ يبوظ بسبب null، بدأت آخد الموضوع بجدية وأستخدم null safety صح. كل غلطة من دول كانت درس، وكل حاجة فهمتها خلتني أكتب Flutter بشكل أنضف وأسرع وأكتر احتراف. لو إنت في بداية طريقك، خد بالك من الحاجات دي وابدأ صح من الأول.
5
12
177
11,597
15 Dec 2025
my hot take is that we should be able to create special class keywords classdef widget<T> = T extends StatelessWidget; widget Foo(String text){ } equals class Foo extends StatelessWidget { Foo(this.text); final String text; }
2
5
683
The takeaway: StatelessWidget is a clever trick that greatly reduced boilerplate, but StatefulWidget is much more faithful to the underlying mechanics.
1
3
427
Many components don’t need lifecycle methods or state. We can move the props, render method, and logic to create the element all into a single class: we’ll call that StatelessWidget.
1
3
205
Great question. StatelessWidget and StatefulWidget are heavily inspired by React’s class component model: react.dev/reference/react/Co…
Replying to @LoicSharma @mraleph
Why do we need a separate state at all? Why can't we have a StatefullWidget that looks like a a stateless one?
4
20
3,554
22 Nov 2025
Replying to @pythonhubdev
No, what I mean is, abandon StatelessWidget and StatfulWidget. There should only be one base Widget class. Scafold itself is a widget implementation of the Widget class. It can also be directly inherited and used (and actually is now).
1
2
45
20 Nov 2025
I've recently made some progress on a method to detect the current widget's element without passing any context in a StatelessWidget. Therefore, I'm not in a rush to release a new version of Oref (to adapt alien_signals 2); I hope to release it along with this improvement.😁
3
1
25
2,197
Thanks for sharing! The main trade offs imo are you're using a service locator pattern which makes scoping state to a portion of the widget tree much harder and you have to refactor StatelessWidget -> WatchingWidget which feels a bit invasive imo.
3
10
611
A surprising number of developers aren’t fully aware of the difference between imperative and declarative coding. Yet this idea is crucial to understand, especially because #FlutterDev is a declarative framework. Welcome to "Mastering the Flutter Fundamentals" series (3/n) In an imperative style, you tell the system exactly how to do something: every step/mutation/instruction. // Imperative example button.setText("Submit"); button.setColor("blue"); button.moveTo(x: 20, y: 100); In a declarative style, you describe what the UI should look like, given the current state. The framework figures out the underlying steps. // Declarative example class SubmitButton extends StatelessWidget { final bool isLoading; const SubmitButton({required this.isLoading}); @ override Widget build(BuildContext context) { return ElevatedButton( onPressed: isLoading ? null : () {}, child: Text(isLoading ? "Loading..." : "Submit"), ); } } No manual mutations. Just a description: if the state is X, the UI looks like Y. And hence, UI = f(state) The result is code that behaves more predictably, reads more cleanly, and avoids a whole class of bugs caused by scattered changes.
6
3
38
1,892
4 Nov 2025
(3/4) it means that in a StatelessWidget, I can get and manipulate the current element without passing context, without mixins, and without inheriting a base class.
1
4
349