What programming language do Flutter apps use?
Click to see answer
Flutter apps use the Dart programming language.
Click to see question
What programming language do Flutter apps use?
Flutter apps use the Dart programming language.
What are getter and setter methods?
Getter methods read data from class fields, while setter methods set data to class fields.
What is the purpose of an event channel in Flutter?
To send a stream of data from the native platform back to Flutter, useful for monitoring sensor data.
What is the main advantage of using Flutter?
It allows building applications for multiple platforms from a single codebase.
What does the View component represent in the MVC pattern?
The UI layer that holds visible components and provides visualization of the data stored in the Model.
What is the purpose of using TextFormField in a Form?
To save, reset, or validate multiple fields at once.
What is AppLifecycleState?
AppLifecycleState represents the state of the application, including inactive, paused, resumed, and suspending.
What do the ?? and ? operators do in Dart?
They handle null values and prevent null reference errors.
How do Flutter widgets respond to state changes?
When a widget’s state changes, it rebuilds its description, and the framework determines the minimal changes needed in the render tree.
What happens when the null-aware access operator (?.) is used on a null object?
Nothing happens; the method or property is not accessed.
When is a stateful widget often sufficient?
When making a quick demo app.
What does the 'resumed' state signify in AppLifecycleState?
The application is visible and responding to user input.
What is the purpose of the Null Aware Operator in Dart?
To allow computations based on whether a value is null, serving as shorthand for longer expressions.
What are named parameters in Dart?
Named parameters are parameters that can have default values and are specified by name when calling a function.
What does the 'final' keyword mean in Dart?
It indicates single-assignment; a final variable must have an initializer and cannot be changed once assigned.
Who is the creator of Flutter?
Flutter is developed by Google.
What is Dart?
An open-source programming language developed by Google in 2011 for creating frontend user interfaces for web and mobile apps.
What happens when a widget's state changes?
The widget is rebuilt to reflect the updated state, resulting in a dynamic, responsive user interface.
What is the difference between debug mode and release mode?
Debug mode includes debugging information for easy debugging, while release mode usually has optimizations enabled.
What is a Stream in Dart?
A Stream is like an async Iterator in JavaScript, representing values that can change over time, often used for web sockets or events.
What are dev_dependencies in Flutter?
A list of plugins used during the development stage to test the app.
What is the purpose of the AspectRatio widget?
To size the child to a specific aspect ratio based on the largest width permitted by layout constraints.
What is the difference between Double.infinity and MediaQuery?
Double.infinity means to be as big as the parent allows, while MediaQuery means to be as big as the screen.
What is the difference between dependencies and dev_dependencies in Dart?
Dependencies are packages required for the app to run, while dev_dependencies are packages needed only during development.
How do you define a function with optional positional parameters in Dart?
Use square brackets around the optional parameters in the function definition.
What is a key difference between Future and Stream?
A Future returns only once, while a Stream can return multiple times as values change over time.
What happens to state values during Hot Reload?
State values are preserved and do not update; they remain at their current values.
What is the effect of Hot Restart on state values?
Hot Restart destroys preserved state values and resets them to their default.
What is the purpose of the View layer in the MVVM architecture?
To inform the ViewModel about the user’s action and observe the ViewModel without containing application logic.
When do we use debug mode in Flutter?
During development, when you want to use hot reload.
What is a Flutter plugin?
A wrapper of native code for Android (Kotlin or Java) and iOS (Swift or Objective-C).
What is an adaptive app?
An adaptive app adjusts to run on different device types, such as mobile and desktop, and requires handling mouse and keyboard inputs.
What is Ephemeral State?
Ephemeral State refers to state variables that are inside of the Stateful widget.
What is the difference between Material and Cupertino widgets?
Cupertino widgets are used to build iOS-like apps, while Material widgets implement the Material design language for various platforms including Android.
What does the 'inactive' state mean in AppLifecycleState?
The application is in an inactive state and is not receiving user input (iOS only).
Why is the MVP pattern widely accepted?
It provides modularity, testability, and a cleaner, more maintainable codebase.
What does dynamic mean in Dart?
It can change the TYPE and VALUE of the variable later in code.
What is a required parameter in Dart?
A parameter that must be provided when calling a function, like in the example findVolume(int length, int breath, int height).
Which state management solutions are recommended for those overwhelmed by options?
ChangeNotifier with Provider or MobX, as they allow direct method calls on the state class in response to events.
What are the two states of a Future?
Uncompleted or completed.
When should you use a Future?
When you want a value that may not be available right now but will be available later and will not change.
What is the difference between final, const, and static?
Final can't change TYPE or VALUE; const is a compile-time constant; static modifies members and retains values until program execution finishes.
How do both StreamBuilder and FutureBuilder behave?
They listen to changes and trigger a new build when notified of a new value.
What is the purpose of a Key in Flutter?
A Key is a unique identifier for a widget that helps Flutter identify it from its previous state.
What are some common state management solutions in Flutter?
Provider, Riverpod, Bloc, and Redux.
What role does the ViewModel play in MVVM?
It exposes relevant data streams to the View and serves as a link between the Model and the View.
What is the definition of 'State' in Flutter?
A widget’s 'state' is the information or data that it holds over time, determining how the widget should be displayed on the screen.
What does the View layer do in the MVVM pattern?
It provides the UI and visualizes data while tracking user actions to notify the Presenter.
How does Flutter communicate with native code?
Through the use of Platform Channels and Message Passing.
What does MediaQuery provide?
The actual size of the device and detailed information about its layout preferences.
What are some major features of Flutter?
Fast development, expressive and flexible UI, and native performance.
How does Hot Reload work in Flutter?
It compiles newly added code and sends it to the Dart Virtual Machine, which then updates the app UI with widgets.
Why are isolates used in Flutter?
Isolates are used for concurrent execution of tasks that may take a long time, such as network requests or computationally intensive operations.
What does the layered architecture in Flutter allow for?
It enables full customization of the UI, resulting in fast rendering and expressive designs.
What does var mean in Dart?
It can’t change the TYPE of the variable, but can change the VALUE later in code.
Can you give an example of a required parameter function in Dart?
findVolume(int length, int breath, int height) { print('length = breath, height = $height'); }
What triggers widget rebuilding in Flutter?
State changes.
Can you use platform channels on the web in Flutter?
No, platform channels are not used on the web.
How does the app widget tree behave during Hot Restart?
The app widget tree is completely rebuilt with a new type of code.
What programming language is used in Flutter?
Dart programming language.
How does Flutter achieve high performance?
By compiling to native ARM code and using a high-performance rendering engine.
What is tree shaking in Flutter?
An optimization technique that removes unused modules during the build process, effectively eliminating dead code.
What is the role of the Model in the MVC pattern?
It stores application data, handles domain logic, and communicates with database and network layers.
What is the purpose of profile mode in Flutter?
To analyze performance.
What is a GlobalKey in Flutter?
A GlobalKey is unique across the entire app and is useful for identifying a widget from a different part of the app.
How does the null coalescing operator (??) work with the variable 'name'?
If 'name' is null, 'Admin' is assigned to 'userName'; otherwise, 'name' is assigned to 'userName'.
What is the purpose of Flutter packages?
To speed up development by using code from utility libraries.
What does LayoutBuilder depend on?
The size of the original widget and the constraints provided by the parent widget.
How can you manage App State?
By using a state management solution such as inherited widget or a third-party library.
What are optional positional parameters in Dart?
Parameters that can be disclosed with square brackets and are not required.
What is a key similarity between Future and Stream in Dart?
Both are used for asynchronous programming and will return in the future.
How does Flutter achieve native performance?
By incorporating critical platform differences such as scrolling, navigation, and icons into its widgets.
What is the syntax for calling a function with optional parameters?
You can call it with or without the optional parameters, e.g., findVolume(10, 20, 30) or findVolume(10, 20).
What does static mean in Dart?
It means a member is available in the class itself instead of on instances of the class.
What is the output of the function findVolume(10, 20)?
length = 10, breath = 20, height = null.
What does the createState() method return?
A class that extends the Flutter State Class.
What is the main difference between a function and a method?
A function is free and can exist anywhere, while a method is a member of an object or class.
When was the first alpha version of Flutter released?
May 2017.
What does it mean for an app to be responsive?
A responsive app has its layout adjusted for the available screen size, often re-laying out the UI based on window size or device orientation.
What is the difference between expanded and flexible widgets?
Expanded takes up all available space along the main axis, while Flexible allows a child to be flexible in its size.
What is the function of the Controller in the MVC pattern?
It establishes the relationship between the View and the Model, containing core application logic and updating the Model based on user responses.
What are Flutter widgets?
Components built using a modern framework that allows you to construct your UI out of widgets.
How does the MVVM pattern differ from the MVP pattern?
In MVVM, the ViewModel replaces the Presenter and separates data presentation logic from core business logic.
What are some popular state management solutions in Flutter?
BLoC, ChangeNotifier with Provider, Redux, MobX, and RxDart.
How can you consume values from an asynchronous generator?
Using a for loop or the await for syntax.
What design language do Material widgets implement?
The Material design language.
Why is it important to use keys judiciously in Flutter?
Keys can have a performance impact on your app, so they should only be used when necessary.
Can you await the results of an asynchronous generator?
No, you cannot await the results of an asynchronous generator.
What does deactivate indicate in Flutter?
It indicates that a widget may be disposed but is not guaranteed.
When should you use a Stream?
When you want to react to changes in a value over time.
What is Flutter?
Flutter is an open-source software development kit developed by Google.
What is Flutter?
Flutter is an open-source framework by Google for building beautiful, natively compiled, multi-platform applications from a single codebase.
What are the three components of the MVC pattern?
Model, View, and Controller.
What does the Flex widget do in Flutter?
It allows control over the axis along which children are placed, either horizontally or vertically.
How do you create private variables in Dart?
By using an underscore '_' before the variable name, making it accessible only within the same file.
What is the focus of widget tests?
To ensure UI widgets have the components that you expect.
What does an asynchronous function return?
A Future object.
What does the MVP pattern aim to overcome?
The challenges of the MVC pattern.
What is a ValueKey in Flutter?
A ValueKey is based on a value (like a string or integer) and is useful for identifying a widget within a list based on its value.
How does AOT compilation work in Dart?
The AOT-compiled code runs inside an efficient Dart runtime that enforces the sound Dart type system and manages memory using fast object allocation and a generational garbage collector.
How is BuildContext useful?
It allows you to get a reference to the theme or another widget, such as using Scaffold.of(context) to show a material dialog.
What is an example use case for asynchronous functions?
Performing operations that may take time, like making a network request or reading a file.
How do the Model and ViewModel work together in MVVM?
They collaborate to get and save data.
What is the difference between hot reload and hot restart?
Hot reload updates the UI without losing the app state, while hot restart resets the app state.
Why is it important to reduce unnecessary widget rebuilding?
To avoid wastefulness and improve performance by not rebuilding parts of the UI that don’t need to change.
What is a Stateful widget in Flutter?
A widget that allows us to refresh the screen and has a createState() method.
Can you nest a Scaffold in Flutter?
Yes, you can nest a Scaffold, which is one of the features of Flutter.
What is the role of the event loop in Flutter?
It coordinates the execution of code across multiple isolates by sending messages and scheduling execution.
What are the two key differences between a method and a function?
What is the purpose of the LayoutBuilder widget in Flutter?
It allows the framework to call the builder function at layout time and provides the parent widget’s constraints.
What is the purpose of the async* keyword in Dart?
Marks a function as an asynchronous generator, returning an object that implements the Stream interface.
What is the purpose of the Scaffold widget in Flutter?
It controls the entire UI and can be nested to layer drawers, snack bars, and bottom sheets.
Why is using MediaQuery in certain situations considered bad?
It is rarely needed unless creating a widget similar to Scaffold.
What is the null-aware access operator (?.) used for?
To access properties or methods of an object that may be null without throwing a null reference error.
What is the difference between WidgetsApp and MaterialApp?
WidgetsApp is a convenience class for common application widgets, while MaterialApp adds material-design specific functionality.
What is a Future in Dart?
A Future represents a potential value or error that will be available at some time in the future.
What additional features does MaterialApp provide?
Material-design specific functionality like AnimatedTheme and GridPaper.
What does final mean in Dart?
It can’t change the TYPE or VALUE of the variable later in code.
What is the purpose of the pubspec.yaml file?
It handles importing images, fonts, and third-party packages, and defines the dependencies of your Flutter project.
What language is the metadata in the pubspec.yaml file written?
YAML language.
What is the difference between a Flutter package and a Flutter plugin?
A package contains only Dart code, while a plugin contains both Dart and native code (kotlin/js/swift/etc.).
When should you use a Stateless widget?
When the screen or widget contains static content.
How is a function defined?
A function is a piece of code called by name, can take parameters, and optionally return data.
What is a stream in Flutter?
A stream is a sequence of asynchronous events that provides an asynchronous sequence of data, allowing multiple listeners to receive the same value.
What do unit tests check in Flutter?
The validity of your business logic.
What paradox occurs when using double.infinity with certain Widgets?
The parent allows any size, while the child wants the biggest size allowed by the parent.
What is the event loop in Flutter?
The event loop is a central concept that manages the flow of control within an app, processing events and updating the app’s state.
What do integration tests verify?
That your app is working as a whole.
What happens when you listen to a Stream?
You receive each new value, as well as notifications if the Stream has an error or has completed.
What is the responsibility of the ViewModel in the MVVM pattern?
It manages the state of the View and takes actions based on user input notifications from the View.
What role does WidgetsApp play in a Flutter application?
It binds the system back button to pop the Navigator or quit the application.
How can you handle the value or error of a Future?
By registering callbacks that handle the value or error once it is available.
What is the difference between deactivate and dispose in Flutter?
Deactivate is called when a widget is removed from the tree temporarily, while dispose is called when it is removed permanently.
What languages can be used for writing native code in Flutter?
Java or Kotlin for Android, and Objective-C or Swift for iOS.
What does a Future represent in Dart?
An asynchronous request with one and only one response.
Can you name some examples of Stateful widgets?
Checkbox, Radio, Slider, InkWell, Form, and TextField.
How does the 'const' keyword differ from 'final' in Dart?
'const' makes a variable constant at compile-time, while 'final' allows for runtime assignment.
What are the three main types of tests in Flutter?
Unit tests, widget tests, and integration tests.
Which Widgets allow their children to be as big as they want?
Column, ListView, OverflowBox.
How does MediaQuery differ from LayoutBuilder?
MediaQuery provides a higher-level view of the app’s screen size and device layout preferences, while LayoutBuilder depends on the size of the enclosing parent widget.
What are dependencies in Flutter?
A list of plugins included while deploying the app after development.
What is the main difference between Hot Reload and Hot Restart in Flutter?
Hot Reload updates changes without losing the previous state, while Hot Restart removes the previous state and runs the complete program.
What is an isolate in Flutter?
An isolate is a separate thread of execution that is isolated from the main thread, allowing for concurrent execution of code.
What is BuildContext in Flutter?
It is the widget's element in the Element tree, unique to every widget.
What is the difference between Stateless and Stateful Widgets in Flutter?
Stateless widgets do not depend on dynamic data, while Stateful widgets can change dynamically and maintain mutable state.
What does the Model layer in MVVM abstract?
It abstracts the data sources.
Why are Stateful widgets referred to as dynamic?
Because they can change their inner data during the widget’s lifetime.
What does the 'suspending' state mean in AppLifecycleState?
The application will be suspended momentarily (Android only).
What is the difference between a synchronous operation and a synchronous function?
A synchronous operation blocks other operations until it completes, while a synchronous function only performs synchronous operations.
Is Flutter a programming language?
No, Flutter is an SDK (Software Development Kit).
What are DevTools in Flutter?
A set of tools for performance management and debugging, allowing inspection of UI layout and diagnosing performance issues.
What does the async keyword do in Dart?
Marks a function as asynchronous, returning a Future object that can be awaited.
What is the purpose of the null coalescing operator (??) in Dart?
To provide a default value when an expression evaluates to null.
Why should you use the const constructor in Flutter?
It tells Flutter that it doesn't need to rebuild the widget.
What is a UniqueKey in Flutter?
A UniqueKey is unique within a widget's parent and is useful for identifying a widget within a list of widgets.
What is App State?
App State refers to state variables that are outside of the Stateful widget and are used by many widgets.
What does TextFormField wrap around?
A TextField widget in a FormField.
What does the 'paused' state indicate in AppLifecycleState?
The application is not currently visible to the user, not responding to user input, and running in the background.
What technology is Flutter built with?
C, C++, Dart, and Skia.
What is the main difference between StreamBuilder and FutureBuilder?
FutureBuilder is for one-time responses, while StreamBuilder is for continuous data updates.
What state management solutions are suitable for handling undo/redo functionality?
BLoC or Redux, as they handle immutable states well.
Why are null-aware operators useful in Dart?
They make nullable types usable without throwing an error, especially when parsing JSON data.
What does dispose indicate in Flutter?
It indicates that a widget is being removed from the tree permanently.
What are the differences between MVC, MVP, and MVVM architecture patterns?
MVC separates the application into Model, View, and Controller; MVP separates it into Model, View, and Presenter; MVVM separates it into Model, View, and ViewModel.
What happens when 'const' is used on an object in Dart?
It makes the object's entire deep state fixed at compile time, rendering it frozen and immutable.
What is the role of the Model in the MVVM pattern?
It stores data, handles domain logic, and communicates with the database and network layers.
What is a factory constructor in Dart?
A factory constructor can return an existing instance of a class instead of creating a new one, useful for memory management or costly operations.
How does the Expanded widget function in Flutter?
It changes the constraints sent to the children of rows and columns, helping to fill the available spaces.
What happens when an async function runs until the first await keyword?
All synchronous code before the first await keyword executes immediately.
What is a recommended practice for the subtree of a stateful widget?
Keep the subtree as small as possible and create a custom widget with a child parameter if needed.
What does an asynchronous generator function return?
An object that implements the Stream interface.
What plugins are commonly used in the development stage of Flutter?
Mockito and test plugins.
What is the role of a GlobalKey when using TextFormField without a Form?
To save or reset the form field.
When should you typically use Double.infinity?
When you want a widget to take up as much space as its parent allows.
What key combination is used for Hot Reload in Flutter?
The Small 'r' key on the command prompt or Terminal.
How can keys help when reordering items in a list?
Keys can identify each item and preserve its state when it is reordered.
What are the two kinds of streams in Dart?
Single subscription streams and broadcast streams.
What is one method to reduce widget rebuilding?
Refactor a large widget tree into smaller individual widgets, each with its own build method.
What is a broadcast stream?
A stream intended for individual messages that can be handled one at a time, allowing multiple listeners.
What is the purpose of the Flexible widget in Flutter?
To resize widgets in rows and columns while adjusting the space of different child widgets in relation to their parent widgets.
What is the primary purpose of Dart?
To create frontend user interfaces for web and mobile apps.
What is the function of the Presenter in the MVP pattern?
It fetches data from the model and applies UI logic to decide what to display.
When is it sufficient to use TextField instead of TextFormField?
For simple user input capture.
What is an example of an async function in Dart?
Future test2() async { var a = await fetchData(); }
How does Flutter enable fast development?
By providing a rich set of fully customizable widgets to build native interfaces quickly.
When should you use keys in Flutter?
Whenever you need to identify a widget and preserve its state, especially in lists or forms.
Which state management solutions are recommended for stream-based solutions?
BLoC or RxDart.
How do you communicate with native code in a Flutter app?
You can use platform channels, specifically method channels, to send serialized data between Dart and native code.
What type of tasks is FutureBuilder commonly used for?
Handling one-time asynchronous requests like HTTP calls.
What happens if an optional parameter is not passed in Dart?
It defaults to null.
What is a single subscription stream?
A stream that contains a sequence of events that must be delivered in order and can only be listened to once.
Which takes longer, Hot Reload or Hot Restart?
Hot Restart takes much longer than Hot Reload.
What does the initState() method do?
It is called first after the widget is created, similar to onCreate() in Android.
What is the purpose of using keys in forms with multiple input fields?
To identify each field and preserve its state as the user fills out the form.
What kind of updates does StreamBuilder listen for?
Continuous data updates like location updates or music playback.
Why is Flutter popular among developers?
Due to its fast development, expressive UI, and native performance.
What is a widget in Flutter?
A widget is a basic building block of a Flutter app's user interface.
What is the difference between an asynchronous operation and an asynchronous function?
An asynchronous operation allows other operations to execute before it completes, while an asynchronous function performs at least one asynchronous operation and can also perform synchronous operations.
What happens if you try to listen to a single subscription stream again?
You may miss initial events, making the rest of the stream nonsensical.
When can you start listening to a broadcast stream?
At any time, and you will receive events that occur while you are listening.
When should you use Keys in Flutter?
When the widget tree changes, to preserve the state of widgets.
What is the purpose of the didUpdateWidget() method?
It is called when the parent widget changes and needs to redraw the UI.
What is a Stateless widget?
A widget that will never rebuild by itself and has no state information.
What is the first method called in the Stateful widget lifecycle?
createState().
What does the dispose() method do in the Stateful widget lifecycle?
It is called when the object and its state are removed from the tree.
What are some key features of Flutter?
Hot reload, rich widget library, and cross-platform capabilities.
What is 'hot reload' in Flutter?
A feature that allows developers to see changes in the code instantly without restarting the app.
What is the purpose of the 'pubspec.yaml' file in Flutter?
It manages the project's dependencies and metadata.
What is the difference between Stateful and Stateless widgets?
Stateful widgets maintain state that can change, while Stateless widgets do not.
What happens in the build() method of a Stateful widget?
All the GUI is rendered and it is called every time the UI needs to be rendered.