Loading ...

Flutter Interview Questions & Answers (2025 Edition)

1. What is Flutter?

Flutter is Google’s UI toolkit for building natively compiled applications for mobile, web, and desktop from a single codebase using Dart language.

import 'package:flutter/material.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp(home: Scaffold(body: Center(child: Text('Hello Flutter')))); } }

2. Difference between StatelessWidget and StatefulWidget

  • StatelessWidget: Immutable, does not change over time.

  • StatefulWidget: Mutable, maintains state that can change.


3. What is hot reload in Flutter?

Instantly updates the running app after code changes, without losing app state.


4. What are Widgets in Flutter?

Everything in Flutter is a widget: UI elements, layout elements, and even the app itself.


5. Difference between Container and SizedBox

  • Container: Adds decoration, padding, margin, constraints.

  • SizedBox: Only for spacing with fixed width/height.

SizedBox(height: 20)

6. Explain main.dart

main.dart is the entry point of a Flutter app where runApp() is called.


7. What is pubspec.yaml?

Configuration file for dependencies, assets, fonts, and metadata of Flutter project.


8. How to add an image asset?

flutter: assets: - assets/images/logo.png
Image.asset('assets/images/logo.png')

9. Difference between Column and Row

  • Column: Vertically aligns children

  • Row: Horizontally aligns children


10. What is the difference between const and final in Dart?

  • const: Compile-time constant, immutable

  • final: Initialized once at runtime


Medium Questions (11–20)

11. Explain Flutter navigation

Flutter supports stack-based navigation using Navigator.push() and Navigator.pop().

Navigator.push(context, MaterialPageRoute(builder: (_) => SecondPage()));

12. What is a Future in Dart?

Represents a value that will be available later, usually for async operations.

Future<String> fetchData() async => "Data loaded";

13. Difference between async, await, and then()

  • async/await: Syntactic sugar for readable async code

  • then(): Chaining futures

fetchData().then((data) => print(data));

14. Explain Stream in Dart

A stream emits a sequence of values over time, useful for real-time updates.

Stream<int> counter() async* { for (int i = 0; i < 3; i++) yield i; }

15. Difference between Hot reload and Hot restart

  • Hot reload: Updates UI, keeps state

  • Hot restart: Restarts app, loses state


16. How to implement themes in Flutter

MaterialApp( theme: ThemeData(primaryColor: Colors.blue), darkTheme: ThemeData.dark(), )

17. Explain InheritedWidget

Used to pass data down the widget tree efficiently without passing through constructors.


18. Difference between Expanded and Flexible

  • Expanded: Fills available space

  • Flexible: Fills available space proportionally


19. How to manage state in Flutter

  • setState() – basic state management

  • Provider – recommended for larger apps

  • Riverpod, BLoC, GetX – advanced state management


20. Explain GestureDetector

Detects gestures like tap, double-tap, swipe, and long-press.

GestureDetector( onTap: () { print("Tapped!"); }, child: Container(color: Colors.blue, height: 50, width: 50), )

Difficult Questions (21–30)

21. Explain Flutter’s widget lifecycle

  • initState(): Called once when widget is inserted

  • didChangeDependencies(): Called when dependencies change

  • build(): Builds UI

  • dispose(): Called when widget removed


22. Difference between ListView.builder and ListView

  • ListView: Loads all children at once

  • ListView.builder: Lazily builds children for better performance


23. What is FutureBuilder?

Widget that builds UI based on a Future’s state.

FutureBuilder<String>( future: fetchData(), builder: (context, snapshot) { if (snapshot.connectionState == ConnectionState.done) return Text(snapshot.data!); return CircularProgressIndicator(); }, )

24. What is StreamBuilder?

Widget that builds UI based on streamed data.


25. Explain Flutter’s rendering process

Flutter renders using a 3-layer architecture: Widget → Element → RenderObject.

  • Widgets: Immutable description

  • Elements: Runtime representation

  • RenderObjects: Handle layout and painting


26. Difference between Navigator 1.0 and Navigator 2.0

  • 1.0: Stack-based, imperative

  • 2.0: Declarative, handles deep linking and web routes


27. How to optimize Flutter app performance

  • Use const constructors

  • Use ListView.builder instead of ListView

  • Avoid rebuilding widgets unnecessarily

  • Use RepaintBoundary and shouldRepaint


28. Explain BLoC pattern

Business Logic Component separates UI and business logic.
Uses Streams to handle state.


29. How to handle JSON in Flutter

import 'dart:convert'; var jsonString = '{"name": "Alice"}'; var data = jsonDecode(jsonString); print(data['name']); // Alice

30. Difference between Hot reload and app release

  • Hot reload: Development-time tool

  • Release mode: Compiled app for production

✍️ By Not available | 2025-10-21T09:08:21.967Z

Call Our Course Advisors

IND: +91-98018 30173 / +91-70429 28331

US: +1-252 490 1033

UK: +44-121 3871751