Answer
Overview
Dart/Flutter has many keywords that define the language's structure. Here are the most important ones to know for interviews and development.
Variable & Type Keywords
dartvar // Type inferred from value final // Set once, value known at runtime const // Compile-time constant dynamic // No type safety — runtime typed late // Initialize later (non-null) Object // Base of all Dart objects void // No return value Null // Null type // Examples var name = 'Alice'; final age = 28; const pi = 3.14159; dynamic anything = 42; late String lazyValue; // Initialize before use
Class & OOP Keywords
dartclass // Define a class abstract // Cannot be instantiated directly extends // Inherit from parent class implements // Implement an interface (all methods required) with // Use a mixin mixin // Define a mixin (reusable code without inheritance) super // Access parent class members this // Reference current instance static // Class-level (not instance) override // Mark method as overriding parent sealed // All subclasses must be in same file (Dart 3+) class Dog extends Animal with Loggable implements Trainable { void speak() => print('Woof'); }
Control Flow Keywords
dartif / else for / while / do-while switch / case / default break / continue return // Dart 3+: pattern matching in switch switch (shape) { case Circle(radius: final r) => print(r); }
Async Keywords
dartasync // Marks function as async await // Wait for Future to complete sync* // Synchronous generator (Iterable) async* // Asynchronous generator (Stream) yield // Emit value from generator yield* // Yield all values from another iterable/stream Future<String> fetchData() async { final response = await http.get(url); return response.body; }
Error Handling
darttry / catch / finally / on / rethrow / throw try { await fetchData(); } on SocketException catch (e) { print('No internet: $e'); } catch (e, stack) { print('Error: $e'); } finally { cleanup(); }
Other Important Keywords
dartimport // Import a library export // Re-export from a file library // Declare library name part / part of // Split library across files typedef // Create function type alias enum // Enumeration extension // Add methods to existing types factory // Constructor that returns instance (can return subtype/cache) operator // Override operators (+, ==, [], etc.) is / as / is! // Type check and cast in // Used in for-in loops new // (Optional) create instance — rarely used in modern Dart
Key Flutter-Specific Annotations
dart// (older code — now just 'required' keyword)
Must-know for interviews:
,textvar,textfinal,textconst,textdynamic,textlate,textasync/await,textabstract,textextends,textimplements,textwith,textmixin,textfactory,textsealed,texttypedef.textextension