Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Taking Flutter to the Web

You're reading from   Taking Flutter to the Web Learn how to build cross-platform UIs for web and mobile platforms using Flutter for Web

Arrow left icon
Product type Paperback
Published in Oct 2022
Publisher Packt
ISBN-13 9781801817714
Length 206 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Damodar Lohani Damodar Lohani
Author Profile Icon Damodar Lohani
Damodar Lohani
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. Part 1: Basics of Flutter Web
2. Chapter 1: Getting Started with Flutter on the Web FREE CHAPTER 3. Chapter 2: Creating Your First Web App 4. Chapter 3: Building Responsive and Adaptive Designs 5. Part 2: Flutter Web under the Hood
6. Chapter 4: Flutter Web under the Hood 7. Chapter 5: Understanding Routes and Navigation 8. Chapter 6: Architecting and Organizing 9. Part 3: Advanced Concepts
10. Chapter 7: Implementing Persistence 11. Chapter 8: State Management in Flutter 12. Chapter 9: Integrating Appwrite 13. Chapter 10: Firebase Integration 14. Chapter 11: Building and Deploying a Flutter Web Application 15. Index 16. Other Books You May Enjoy

Flutter on the web for web developers

If you come from a web development background, this section is for you. Even if you don’t come from a development background, this section still might help you in understanding Flutter on the web in a more meaningful way. You cannot look at Flutter on the web the same way you look at web development. If you look at it that way, you will find lots of things about Flutter on the web that you will not like. Like some others online, you may feel that Flutter on the web is not performant, not ready for the web yet, and so on. As we have already talked about what types of apps benefit from Flutter on the web and what types of apps are not yet suitable to build using Flutter on the web earlier in this chapter, there’s no point arguing again here about the performance and web readiness of Flutter.

To understand Flutter web development, first, you need to understand how Flutter works for mobile apps and how it’s unique.

Flutter as a UI framework

You need to look at Flutter on the web from the fresh perspective that it’s fundamentally different from web development using HTML. Flutter is designed to develop rich, interactive UIs, whereas the web traditionally was designed to serve textual content. But with advances in web technologies, nowadays we deliver all sorts of content on the web, including images, videos, and even graphics intensive games. You also need to think from the point of view that, even though the web is a different platform, Flutter on the web works a bit differently. Flutter is an app-centric UI framework. The web apps built with Flutter provide more of an app-like experience, instead of a traditional web-like experience. We should aim to use that to our advantage.

The first difference we need to understand is that the UI and logic we write with Flutter don’t translate to HTML elements, CSS, and JS one to one. Almost every piece of logic and UI that we write is translated to JavaScript, and the UI is rendered using a combination of the Canvas element, some CSS, SVGs, WebGL, and Web Assembly. Flutter has two different renderers for the web: an HTML renderer, and a CanvasKit renderer. We will learn in detail about these in Chapter 4, Web Flutter under the Hood. However, the fundamental difference is that the HTML renderer uses combinations of HTML elements, CSS, Canvas elements, and SVG elements, and is smaller in terms of download size. Whereas, CanvasKit is fully consistent with Flutter mobile and desktop and has faster performance with higher widget density, but has a bigger download size.

The next difference is that Flutter is not designed for a traditional web experience. We should also keep in mind that the web has also changed a lot since it was originally launched as a medium for sharing text. Only because of this advancement in the web has it been possible to serve all sorts of content including videos, games, and other rich and interactive UIs. Applications built with Flutter are suitable for the modern web.

The next thing that you need to understand is that Flutter on the web is a single-page, client-side application. When a user requests the application, the whole application is loaded entirely in memory. The application requests the information required for different parts of the application and loads it dynamically during execution. That also means that server-side rendering is not yet possible for Flutter web applications. Everything must work on the client. Because of this, SEO is terrible at the moment with Flutter. Though there are some packages in the works by the community, such as https://pub.dev/packages/seo_renderer, which tries to resolve the SEO problem, there hasn’t been any significant progress. So, applications such as blogs might not yet be suitable to be built using Flutter.

Finally, you need to understand that Flutter is not designed to build web pages or websites as we know them. We are not building Flutter web apps to serve traditional web content. Flutter is used to build app-centric, graphics-rich, and interactive applications. Flutter web applications are able to provide the same experience as their mobile application counterparts.

So, while thinking about building your next Flutter web application, do not think in terms of traditional web pages and websites. Rather, think of a mobile application or highly interactive content being delivered via the web.

You have been reading a chapter from
Taking Flutter to the Web
Published in: Oct 2022
Publisher: Packt
ISBN-13: 9781801817714
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime