Beginner Flutter Interview Questions
8 questions
What is Flutter?
Flutter is Google's open-source UI toolkit for building natively compiled apps for mobile, web, and desktop from a single Dart codebase.
What is the difference between StatelessWidget and StatefulWidget?
A StatelessWidget is immutable and rebuilds only when its parent rebuilds; a StatefulWidget holds mutable state via a separate State object and can rebuild itself whenever that state changes.
What is null safety in Dart?
Sound null safety means the compiler distinguishes nullable (`String?`) from non-nullable (`String`) types and guarantees, at compile time, that a non-nullable variable can never hold null.
How does async/await work in Dart?
`async` marks a function as returning a Future and lets you use `await` inside it; `await` pauses execution of that function (without blocking the thread) until the awaited Future completes.
What is the Provider package and how does it work?
Provider is a wrapper around Flutter's InheritedWidget that makes it easy to expose and listen to a piece of state from anywhere below it in the widget tree, and to rebuild only the widgets that actually depend on it.
What is GetX and what does it offer for state management?
GetX is an all-in-one Flutter package combining reactive state management, dependency injection, and route navigation, designed to minimize boilerplate with a small, simple API.
Why should you use const widgets in Flutter?
A `const` widget is created once at compile time and reused across rebuilds — Flutter can skip rebuilding it entirely because it knows the instance can never change.
How do you implement Firebase Authentication in Flutter?
Add the `firebase_auth` package, initialize Firebase in `main()`, then use `FirebaseAuth.instance` to sign users in (email/password, Google, etc.) and listen to `authStateChanges()` to react to login/logout across the app.