Chapter 11

  1. What are the steps required to enable web development to your Flutter environment?
    As of Flutter version 1.14, web development for Flutter is available in the beta channel, and you need to set up the environment to explicitly enable web support. In your Terminal/command prompt you need to type the following command to enable the beta channel and web development:

flutter channel beta flutter config --enable-web
  1. What's the difference between physical and logical pixels?
    Physical pixels are the actual number of pixels that a device has. In Flutter, when we speak of pixels, we are actually speaking of logical pixels, and not physical pixels. Each device has a multiplier so that when you use logical pixels, you don't have to worry too much about the resolution of a screen.

  2. How can you know the width of your user's device?
    You can use the MediaQuery.of(context).size.width instruction to get the width of your user’s device.

  3. When using a Table widget, how do you add rows and cells?
    In the children property of a Table, you return as many TableRow widgets as are required. The TableRow widget contains TableCell widgets, which in turn contain the data that will be shown in the Table.

  4. What's the meaning of responsive design?
    It’s a design that responds to the user’s device. In this chapter, we chose different layouts based on the number of logical pixels available on the screen.

  5. What's the purpose of the FlexColumnWidth widget?
    FlexColumnWidth widget makes each column take a relative space in the Table. For example, if you create a Table with two columns, one with a width of FlexColumnWidth(1) and the second with a width of FlexColumnWidth(2), the second column will take twice the space of the first one.

  1. What's the purpose of shared_preferences?
    shared_preferences is an easy way to persist key-value data on disk. You can only store primitive data: int, double, bool, String, and stringList. shared_preferences data is saved within the app and is not designed to store a lot of data.

  2. Would you use shared_preferences to store passwords? Why?
    It’s not recommended to use shared_preferences to store passwords: data stored there is not encrypted, and writes are not always guaranteed.

  3. How can a browser run a Flutter app?
    Browsers today support HTML, JavaScript, and CSS. With Flutter Web, your code gets compiled in those languages, and therefore you don't need any browser plugin, nor any specific web server.

  4. How can you publish a Flutter app to a web server?
    From the console of your developing machine, you can run the command:

flutter build web

This will create the uildweb folder in your app directory, that contains the web version of your app. The index.html file is the home page of the web app.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.12.136.119