All Projects → fnplus → HACKTOBERFEST-2020-flutter-interview-questions

fnplus / HACKTOBERFEST-2020-flutter-interview-questions

Licence: MIT license
Flutter interview questions with answers

Projects that are alternatives of or similar to HACKTOBERFEST-2020-flutter-interview-questions

Front-end-Job-Interview-Questions
Ответы на вопросы на должность Frontend разработчика.
Stars: ✭ 236 (+436.36%)
Mutual labels:  interview-questions, interview-preparation
counter-interview.dev
a collaborative collection of interview questions collected from both sides of the game: Interviewer(s) and Interviewee.
Stars: ✭ 102 (+131.82%)
Mutual labels:  interview-questions, interview-preparation
codewars python solutions
My CodeWars solutions in Python.
Stars: ✭ 111 (+152.27%)
Mutual labels:  interview-questions, interview-preparation
pw
Best websites a Programmer should visit
Stars: ✭ 27 (-38.64%)
Mutual labels:  interview-questions, interview-preparation
CodingInterview
Leetcode解题、剑指offer第二版💪💪💪⛷😀
Stars: ✭ 28 (-36.36%)
Mutual labels:  interview-questions, interview-preparation
Algorithmic-Problem-Solving
Solutions of algorithmic type of programming problems from sites like LeetCode.com, HackerRank.com, LeetCode.com, Codility.com, CodeForces.com, etc. using Java.
Stars: ✭ 20 (-54.55%)
Mutual labels:  interview-questions, interview-preparation
Competitive-Coding-and-Interview-Problems
This repo contains some problem solutions from different popular coding platforms like Code Chef, Leet Code, Hacker Blocks,etc.
Stars: ✭ 54 (+22.73%)
Mutual labels:  interview-questions, interview-preparation
InterviewPrep
A repository containing link of good interview questions
Stars: ✭ 54 (+22.73%)
Mutual labels:  interview-questions, interview-preparation
ctci-go
Cracking the Coding Interview in Go
Stars: ✭ 31 (-29.55%)
Mutual labels:  interview-questions, interview-preparation
Awesome-Software-Engineering-Interview
No description or website provided.
Stars: ✭ 409 (+829.55%)
Mutual labels:  interview-questions, interview-preparation
interview-questions
Популярные HTML / CSS / JavaScript / ECMAScript / TypeScript / React / Vue / Angular / Node вопросы на интервью и ответы на них (https://tinyurl.com/wxysrpsy)
Stars: ✭ 3,294 (+7386.36%)
Mutual labels:  interview-questions, interview-preparation
Algorithm-Implementations
Lots of algorithm's & their implementations that have been compiled from a variety of locations.
Stars: ✭ 15 (-65.91%)
Mutual labels:  interview-questions, interview-preparation
Test-Bank
Interview preparation and practice problems
Stars: ✭ 43 (-2.27%)
Mutual labels:  interview-questions, interview-preparation
dailycodingproblem
Solutions to Daily Coding Problem questions
Stars: ✭ 26 (-40.91%)
Mutual labels:  interview-questions, interview-preparation
ctci-python-solutions
Cracking the Coding Interview in Python 3. The solutions all have detailed explanations with visuals.
Stars: ✭ 1,062 (+2313.64%)
Mutual labels:  interview-questions, interview-preparation
reactjs-persian-interview-questions
مجموعه برترین سوال و جواب‌های ری‌اکت(احتمالا برای استخدام اینا)
Stars: ✭ 323 (+634.09%)
Mutual labels:  interview-questions, interview-preparation
TheJobInterviewGuide
A job guide to help developers get through interviews and get amazing jobs!
Stars: ✭ 267 (+506.82%)
Mutual labels:  interview-questions, interview-preparation
CPPNotes
【C++ 面试 + C++ 学习指南】 一份涵盖大部分 C++ 程序员所需要掌握的核心知识。
Stars: ✭ 557 (+1165.91%)
Mutual labels:  interview-questions, interview-preparation
Leetcode-solutions
Leetcode Grinder.
Stars: ✭ 14 (-68.18%)
Mutual labels:  interview-questions, interview-preparation
Interview materials
A curated list of all essential job interview preparation materials.
Stars: ✭ 27 (-38.64%)
Mutual labels:  interview-questions, interview-preparation

Flutter Interview Questions with Answers

This repository is a part of HacktoberFest-an event organised by DigitalOcean. You are requested to create your profile using the above link to be a part of it.

  1. What is Flutter?

    Flutter is Google's UI toolkit for crafting beautiful, natively compiled applications for mobile, web, and desktop from a single codebase.

  2. What are the different types of widgets in Flutter?

    Two types of widgets present in the Flutter are stateless and stateful.

    The stateless widgets don’t store any values which will change in the future. The stateless widgets don’t store any state. Icon, text widgets are some examples of stateless widgets.

    The stateful widgets have a state object to keep track of all the changes and updates happening in the UI. These widgets are immutable but the state object is used to keep track of the changes. Checkbox and image are some of the examples of stateful widgets.

  3. Difference b/w Stateful widget and Stateless widget.

    Stateless widgets cannot change their state during the runtime of the app, which means the widgets cannot be redrawn while the app is in action.

    Stateful Widgets are the ones that change its properties during run-time. They are dynamic i.e., they are mutable and can be drawn multiple times within its lifetime.

  4. What is the use of pubspec.yaml file in Flutter?

    The pubspec. yaml file is the most important file in any Flutter project. It is the place where you provide all the required dependencies of your Flutter project.

  5. What is Dart? Why Flutter uses Dart as Programming Language?

    Dart is an object-oriented, garbage-collected programming language that you use to develop Flutter apps. It is created by Google. Dart was chosen as the language of Flutter for the following reason:

    i. Dart is AOT (Ahead Of Time) compiled to fast, predictable, native code, which allows almost all of Flutter to be written in Dart. This makes Flutter fast

    ii. Dart can also be JIT (Just In Time) compiled for exceptionally fast development cycles and game-changing workflow (hotreload).

    iii. Dart allows Flutter to avoid the need for a separate declarative layout language like XML, because Dart’s declarative, programmatic layout is easy to read and visualize. i.e we can do both UI and Buisness Logic using one language only which is "DART"

    iv. Dart Team + Flutter Team As both Dart and Flutter is developed and maintained by Google, hence both Flutter Team and Dart Team work together to solve the problem.

  6. What is the difference between NetworkImage and Image.network in flutter?

    NetworkImage class creates an object the provides an image from the src URL passed to it. It is not a widget and does not output an image to the screen. Image.network creates a widget that displays an image on the screen. It is just a named constructor on the Image class (a stateful widget). It sets the image property using the NetworkImage . This image property is used finally to display the image.

  7. What are mixins in dart?

    Mixins are used for a unique kind of inheritance, they allow other classes to inherit it's baked in methods for use, without actually being a child of the parent Mixin class. In simple words, Mixins are our usual normal classes from which we can borrow methods, without extending the class.

  8. What is hot reload in flutter?

    Flutter’s hot reload feature helps you quickly and easily experiment, build UIs, add features, and fix bugs. Hot reload works by injecting updated source code files into the running Dart Virtual Machine (VM). After the VM updates classes with the new versions of fields and functions, the Flutter framework automatically rebuilds the widget tree, allowing you to quickly view the effects of your changes.

  9. What are the two types of Streams available in Flutter?

    There are two types of Streams available in Flutter which are: ..* Single subscription streams ..* Broadcast streams Single subscription streams : It is a popular and commom type of stream. It consist of series of events that are parts of a large whole. The events here have to be delivered in a defined order without even missing a single event.

    Broadcast streams : This stream is meant for the individual messages that can be handeled one at a time. Multiple listener can listen at a time and it also gives the user the chance to listen after the cancellation of the previous subscription.

  10. What is a Flutter Inspector ?

Flutter Inspector is a tool that helps in visualizing and exploring the widget trees. It also helps in understanding the present layout and rectify the layout issues.

  1. Is CI/CD possible in Flutter?

    Yes, CI/CD is possible in Flutter. There is CI/CD tool dedicated to Flutter the name is CODE MAGIC. With the help of CODE MAGIC we can easily automate the process of CI/CD for flutter apps from single automation.

  2. What’s the difference between hot reload and hot restart?

    Hot reload maintains the app state while updating the UI almost instantaneously whereas Hot restart resets the app state to its initial conditions before updating the UI.

  3. What are Null-aware operators in Flutter ?

    Dart offers some handy operators for dealing with values that might be null.

    a.One is the ??= assignment operator, which assigns a value to a variable only if that variable is currently null
    b.Another null-aware operator is ??, which returns the expression on its left unless that expression’s value is null, in which case it evaluates and returns the expression on its right

  4. What is use of Navigation.push and Navigation.pop function?

    The push method is used to add a route to the stack of routes managed by the navigator. The pop method is used to remove the current route from the stack of routes managed by the navigator.

  5. What is an App state?

    State means that is not ephemeral, that you want to share across many parts of your app, and that you want to keep between user sessions, is what we call application state (sometimes also called shared state).

    Examples of application state:

  • User preferences
  • Login info
  • Notifications in a social networking app
  • The shopping cart in an e-commerce app
  • Read/unread state of articles in a news app
  1. What are the different build modes in Flutter?
  • The Flutter tooling supports three modes when compiling your app, and a headless mode for testing.

  • You choose a compilation mode depending on where you are in the development cycle.

  • The modes are:

    • Debug
    • Profile
    • Release
  1. What is the difference between main() and runApp() functions in Flutter?
  • main () function came from Java-like languages so it's where all program started, without it, you can't write any program on Flutter even without UI.
  • runApp() function should return Widget that would be attached to the screen as a root of the Widget Tree that will be rendered.
  1. What is ScopedModel/BLoC Pattern?

    ScopedModel and BLoC (Business Logic Components) are common Flutter app architecture patterns to help separate business logic from UI code and using fewer Stateful Widgets.

    • Scoped Model is a third-party package that is not included into Flutter framework. It's a set of utilities that allow you to easily pass a data Model from a parent Widget down to its descendants. In addition, it also rebuilds all of the children that use the model when the model is updated. This library was originally extracted from the Fuchsia codebase.

    • BLoC stands for Business Logic Components. It helps in managing state and make access to data from a central place in your project. The gist of BLoC is that everything in the app should be represented as stream of events: widgets submit events; other widgets will respond. BLoC sits in the middle, managing the conversation.

  2. How to avoid widget remount while working with Bottom navigation tabs?

    The effective way to avoid the no of widget rebuilds while working with multiple Widgets as interfaces of a app that uses Bottom Navigation Tabs as it's stratergy it to utilize IndexedStack that will increase the app performace by 2x and reduces the unnecessary widget rebuilds on tab changes.

  3. How do you reduce widget rebuild?

You rebuild widgets when the state changes. This is normal and desirable, because it allows the user to see the state changes reflected in the UI. However, rebuilding parts of the UI that don't need to change is wasteful.

There are several things you can do to reduce unnecessary widget rebuilding.

  • The first is to refactor a large widget tree into smaller individual widgets, each with its own build method.
  • Whenever possible, use the const constructor, because this will tell Flutter that it doesn't need to rebuild the widget.
  • Keep the subtree of a stateful widget as small as possible. If a stateful widget needs to have a widget subtree under it, create a custom widget for the stateful widget and give it a child parameter.
  1. What is BuildContext and how is it useful?

BuildContext is actually the widget's element in the Element tree — so every widget has its own BuildContext. You usually use BuildContext to get a reference to the theme or to another widget. For example, if you want to show a material dialog, you need a reference to the scaffold. You can get it with Scaffold.of(context), where context is the build context. of() searches up the tree until it finds the nearest scaffold.

  1. What is setState() ?

setState notifies the framework that the internal state of an object has changed in a way that might impact the user interface in this subtree, which causes the framework to schedule a build for this State object. If we just change the state directly without calling setState, the framework might not schedule a build and the user interface for this subtree might not be updated to reflect the new state. It is recommended that the setState method only be used to wrap the actual changes to the state, not any computation that might be associated with the change.

  1. Explain why the Arrow operator is used in Flutter?

The Arrow operator is the only one line of code and is a shorthand in Dart, which can we used to write one-line functions.

  1. What is the purpose of a SafeArea?

SafeArea is basically a glorified Padding widget. If you wrap another widget with SafeArea , it adds any necessary padding needed to keep your widget from being blocked by the system status bar, notches, holes, rounded corners and other "creative" features by manufactures.

  1. What is the difference between WidgetsApp and MaterialApp?

WidgetsApp provides basic navigation. Together with the widgets library, it includes many of the foundational widgets that Flutter uses. MaterialApp and the corresponding material library is a layer built on top of WidgetsApp and the widgets library. It implements Material Design, which gives the app a unified look and feel on any platform or device. The material library has many additional widgets that come with it. You certainly aren’t required to use MaterialApp in your project. You can use CupertinoApp to make iOS users feel at home, or you can even build your own set of custom widgets to fit your brand.

  1. Can you nest a Scaffold? Why or why not?

Yes, you can absolutely nest a Scaffold. That’s the beauty of Flutter. You control the entire UI. Scaffold is just a widget, so you can put it anywhere a widget might go. By nesting a Scaffold, you can layer drawers, snack bars and bottom sheets.

  1. When is it appropriate to use packages, plugins or third-party dependencies?

Packages and plugins are great for saving you time and work. There’s no need to solve a complex problem yourself when someone else has done it already, especially if the solution is highly rated. On the other hand, there’s also a danger of being too reliant on third party packages. They can break, have bugs or even be abandoned. When you need to switch to a new package down the road, you might have to make huge changes to your code. That’s why it’s important to isolate packages from your core business logic. You can do that by creating an abstract Dart class that acts as an interface for the package. Once you’ve set up that kind of architecture, all you have to do to switch packages is to rewrite the concrete wrapper class that implements your interface.

  1. What types of tests can you perform?

There are three main kinds of tests: unit tests, widget tests and integration tests. Unit tests are all about checking the validity of your business logic. Widget tests are for making sure UI widgets have the components that you expect them to. Integration tests check that your app is working as a whole. One additional type of test that is not as well known is a golden test. In a golden test, you have an image of a widget or screen and check to see that the actual widget matches it.

  1. How do you talk to native code from within a Flutter app?

One type of platform channel is a method channel. Data is serialized on the Dart side and then sent to the native side. You can write native code to interact with the platform before sending a serialized message back. That message might be written in Java or Kotlin on Android or Objective-C or Swift on iOS. The second type of platform channel is the event channel, which you use to send a stream of data from the native platform back to Flutter. This is useful for monitoring sensor data.

  1. What is the use of having Android and iOS folders in the Flutter project?

Android: This folder is meant for holding an entire Android project. This will come into usage when you want to build a Flutter application for the Android platform. When you compile a Flutter code into the native code, it will enter into the Android project and gives you a native Android application.

iOS: This folder is meant for holding an entire Mac project. This will come into usage when you want to build a Flutter application for the iOS platform. It works similarly to the Android folder. When you compile a Flutter code into the native code, it will enter into the Android iOS project and gives you a native Android application. Building a Flutter application will only be possible when you work on Xcode IDE and macOS.

  1. What are the various types of RenderObjectElement in flutter?

    In flutter we have two types of RenderObjectElements:

    For e.g. Column(children: ) For e.g. Padding(child: )

  2. What is profile mode and when do you use it?

In profile mode, some debugging ability is maintained—enough to profile your app’s performance. Profile mode is used when you want to analyze performance. Profile mode is disabled on the emulator and simulator, because their behavior is not representative of real performance. On mobile, profile mode is similar to release mode, with the following differences: - Some service extensions, such as the one that enables the performance overlay, are enabled. - Tracing is enabled, and tools supporting source-level debugging (such as DevTools) can connect to the process. Profile mode for a web app means that: - The build is not minified but tree shaking has been performed. - The app is compiled with the dart2js compiler. The command flutter run --profile compiles to profile mode.

  1. Why does the first Flutter app build take so long?

When you build the Flutter app the first time, it will take a longer time. It is because the Flutter builds the device-specific APK or IPA file. Thus, the Gradle and Xcode are used to build the file, taking a long time.

  1. What is the purpose of @override used in Flutter?

@override points out that the function is also defined in an ancestor class, but is being redefined to do something else in the current class. It's also used to annotate the implementation of an abstract method. It is optional to use but recommended as it improves readability.

  1. What are the different build modes in Flutter?

The Flutter tooling supports three modes when compiling your app, and a headless mode for testing. You choose a compilation mode depending on where you are in the development cycle. The modes are:

  • Debug
  • Profile
  • Release
  1. Explain async, await, then and Future in Dart?
  • Async means that this function is asynchronous and you might need to wait a bit to get its result.
  • Await literally means - wait here until this function is finished and you will get its return value.
  • .Then((value){…}) is a callback that’s called when future completes successfully(with a value).
  • Future is a type that ‘comes from the future’ and returns value from your asynchronous function. It can complete with success(.then) or with an error(.catchError).

Contributors

Contributing

  1. Have a look at open issues. Pick an unassigned issue.
  2. You can also create new issues (If you add a question or want answer to a particular question ).
  3. Make sure you are assigned for the issue.
  4. Fork the repo!
  5. Clone the forked repository to local system.
  6. Create your feature branch: git checkout -b my-question-answer
  7. Be sure to not include any compiled binaries in the patch.
  8. Commit your changes: git commit -am 'Add some question/answer'. Go through Commit Messages guidelines
  9. Push to the branch: git push origin my-question-answer While sending a PR make sure you follow one issue per PR rule.
  10. Submit a pull request 😄

Notes:

Only project maintainers should merge a PR. Other members can add their reviews to a PR but the merging should be done by only a project maintainer.

Authors:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].