Skip to content

Latest commit

 

History

History
41 lines (32 loc) · 9.53 KB

File metadata and controls

41 lines (32 loc) · 9.53 KB

Builder & Code Generation Interview Questions

This guide contains a consolidated list of 21 Builder & Code Generation interview questions and answers. Select a question below to read the detailed guide or the quick-revision companion.

Easy Questions

No. Question Category Detailed Guide Quick Revision
1 What is code generation (codegen) in Flutter and why is it useful? Basics Detailed Guide Quick View
2 What is the purpose of the freezed package? Freezed Detailed Guide Quick View
3 What is the purpose of the json_serializable package? JSON Serialization Detailed Guide Quick View
4 What is the difference between part and import directives in Dart? Basics Detailed Guide Quick View
5 What are annotations in Dart and how are they used in code generation? Basics Detailed Guide Quick View

Medium Questions

No. Question Category Detailed Guide Quick Revision
1 How do you run the code generator and what is the difference between build and watch commands? build_runner Detailed Guide Quick View
2 How do you customize json keys (e.g., snake_case to camelCase) using @JsonKey and @JsonSerializable? JSON Serialization Detailed Guide Quick View
3 What is the copyWith method generated by freezed and why is it important for immutability? Freezed Detailed Guide Quick View
4 How do you handle default values for properties in a freezed class? Freezed Detailed Guide Quick View
5 How does freezed handle Custom Getters, Setters, or Methods inside an annotated class? Freezed Detailed Guide Quick View
6 How do you serialize/deserialize generic models (like a generic PaginatedResponse) using json_serializable? JSON Serialization Detailed Guide Quick View
7 Should generated files (e.g., .g.dart and .freezed.dart) be committed to Git? build_runner Detailed Guide Quick View
8 What is the purpose of @JsonValue and how does it differ from @JsonKey? JSON Serialization Detailed Guide Quick View

Hard Questions

No. Question Category Detailed Guide Quick Revision
1 Explain union/sealed classes in freezed and how they facilitate type-safe state transitions. Freezed Detailed Guide Quick View
2 How do you implement custom serialization/deserialization for complex types using JsonConverter? JSON Serialization Detailed Guide Quick View
3 How does build_runner manage caching, and how do you resolve builder conflicts or build failures? build_runner Detailed Guide Quick View
4 Explain how to write custom build options in a build.yaml file to exclude files or configure specific builders globally. build_runner Detailed Guide Quick View
5 Explain the performance difference between generated code vs reflection (such as mirrors API in Dart) for JSON parsing. Architecture Detailed Guide Quick View
6 How do you handle class inheritance or polymorphic classes when serializing/deserializing JSON using json_serializable? JSON Serialization Detailed Guide Quick View
7 How do you create a custom code generator in Dart using the source_gen and build packages? Architecture Detailed Guide Quick View
8 How does build_runner handle incremental compilation, and what is the role of build.yaml's build_to: cache vs build_to: source? build_runner Detailed Guide Quick View