0% found this document useful (0 votes)
4 views5 pages

Topic Wise Questions and Answers-Flutter

The document provides an overview of Flutter basics, including widgets, state management, routing, animations, project structure, and Dart programming fundamentals. It explains key concepts such as StatelessWidget vs StatefulWidget, the purpose of various widgets like Container and Scaffold, and state management techniques like Provider and Riverpod. Additionally, it covers navigation methods, animation types, and the structure of a Flutter project, including the use of pubspec.yaml and testing folders.

Uploaded by

kaustavdey71
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views5 pages

Topic Wise Questions and Answers-Flutter

The document provides an overview of Flutter basics, including widgets, state management, routing, animations, project structure, and Dart programming fundamentals. It explains key concepts such as StatelessWidget vs StatefulWidget, the purpose of various widgets like Container and Scaffold, and state management techniques like Provider and Riverpod. Additionally, it covers navigation methods, animation types, and the structure of a Flutter project, including the use of pubspec.yaml and testing folders.

Uploaded by

kaustavdey71
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Flutter Basics & UI Building

1. What is a widget in Flutter?

A widget is the basic building block of a Flutter UI. Everything in Flutter is a widget, including layout
models and UI elements.

2. What is the difference between StatelessWidget and StatefulWidget?

StatelessWidget does not store any state; it builds once. StatefulWidget can store and update state
over its lifecycle.

3. What is the purpose of the Container widget?

Container is used for layout, styling, and positioning of child widgets.

4. What is Scaffold and why is it used?

Scaffold provides a high-level structure for Material apps, including AppBar, Drawer,
BottomNavigationBar, etc.

5. Explain the widget lifecycle in Flutter briefly.

For StatefulWidget: createState() -> initState() -> build() -> setState() -> dispose(). StatelessWidget
only uses build().

6. What is the structure of a basic Flutter app?

main() -> runApp() -> MaterialApp() -> home or routes -> widgets tree.

7. What is Material Design in Flutter?

Material Design is Google’s design system used to create visually rich, responsive UIs with widgets
like AppBar, FAB, etc.

8. What is Cupertino Design? Can it be used in Android apps?

Cupertino is Apple’s iOS-style UI design. Yes, Cupertino widgets can be used on Android too.

9. What is the difference between Material and Cupertino widgets?


Material follows Android design; Cupertino mimics iOS style. Their widgets provide platform-specific
UI experiences.

10. What is the use of safe area in Flutter?

SafeArea prevents UI elements from being drawn in unsafe areas like notches and status bars.

State Management

11. What is state management in Flutter?

It refers to the way you manage data changes and UI updates.

12. What is the difference between local and global state management?

Local state is managed within a widget; global state is accessible across multiple widgets.

13. What is setState() and when is it used?

setState() notifies the framework to rebuild a widget with updated data. Used in StatefulWidget.

14. What is the purpose of the Provider package?

Provider offers a simple and scalable way to manage and share state efficiently.

15. What is Riverpod and how does it differ from Provider?

Riverpod is an improved version of Provider with better testability, no context dependency, and
compile-time safety.

16. What is the role of InheritedWidget in state management?

It allows data to be efficiently passed down the widget tree and is the basis for packages like Provider.

17. What are the advantages of using BLoC pattern?

Separation of concerns, testability, and reusable business logic using streams.

Routing and Navigation


18. What is the routes.dart file used for?

It centralizes route definitions, improving navigation management and maintainability.

19. What is Flutter's Navigator?

Navigator manages a stack of routes and allows navigation between screens.

20. How do you pass data between routes in Flutter?

Use Navigator.push() with arguments or settings to pass data.

21. What is the use of pushNamed, pushReplacementNamed, and pushAndRemoveUntil?

These are named route methods for navigation with different route stack behaviors.

22. What is onGenerateRoute and onUnknownRoute?

These callbacks handle route generation and unknown routes respectively.

23. What is GoRouter and its advantage?

A routing package simplifying navigation with declarative syntax and deep linking support.

24. How can you implement custom route transitions?

Use PageRouteBuilder or define transitions in onGenerateRoute.

25. How is deep linking handled in Flutter?

Using packages like uni_links, go_router, or manually parsing Uri in onGenerateRoute.

Animation

26. What is the difference between implicit and explicit animations?

Implicit: automatic animations using Animated widgets. Explicit: full control using
AnimationController.

27. What is AnimatedContainer used for?


To animate changes in container properties like size, color, and margin.

28. What is the purpose of AnimationController?

Manages animation timing and progress; used in explicit animations.

29. What are the different types of animation curves in Flutter?

linear, easeIn, easeOut, bounceIn, etc. These define motion pacing.

30. How do you optimize animations with AnimatedBuilder?

AnimatedBuilder rebuilds only the animated part, improving performance.

31. What is the purpose of the Hero widget?

Hero enables smooth shared element transitions between routes.

Flutter Project Structure & Tools

32. What is the purpose of the pubspec.yaml file?

It defines metadata, dependencies, and assets for the project.

33. What are dependencies and how are they added?

External packages or plugins. Added in pubspec.yaml under dependencies:.

34. What is the purpose of hot reload in Flutter?

Allows you to quickly refresh the app UI without losing state.

35. What are assets in Flutter?

Static files like images, fonts, and JSON used in the app. Declared in pubspec.yaml.

36. What is an AVD and why is it used?

Android Virtual Device; simulates Android hardware for testing apps.


37. Can we use a mobile phone instead of AVD? How?

Yes, by enabling Developer Options and USB Debugging on the phone.

38. What is the purpose of test folders in Flutter projects?

Used to organize and run unit, widget, and integration tests.

Dart Programming Basics

39. What is the purpose of final and const?

final: runtime constant. const: compile-time constant.

40. What is asynchronous programming in Dart?

Allows non-blocking execution using async, await, and Future.

41. What are Maps and Runes in Dart?

Map: key-value store. Runes: Unicode character representation.

42. What are ternary operators in Dart?

A shorthand condition ? trueValue : falseValue.

43. Explain while and do-while loops.

while: checks condition first. do-while: executes first, checks condition after.

44. Explain the use of if-else with an example.

Used for decision-making. E.g., if(x > 10) print('Hi'); else print('Bye');

45. What is a class in Dart? How is inheritance handled?

A blueprint for objects. Inheritance is done using extends and super.

You might also like