Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Cross-Platform UIs with Flutter

You're reading from   Cross-Platform UIs with Flutter Unlock the ability to create native multiplatform UIs using a single code base with Flutter 3

Arrow left icon
Product type Paperback
Published in Aug 2022
Publisher Packt
ISBN-13 9781801810494
Length 260 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Ryan Edge Ryan Edge
Author Profile Icon Ryan Edge
Ryan Edge
Alberto Miola Alberto Miola
Author Profile Icon Alberto Miola
Alberto Miola
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Building a Counter App with History Tracking to Establish Fundamentals 2. Building a Race Standings App FREE CHAPTER 3. Building a Todo Application Using Inherited Widgets and Provider 4. Building a Native Settings Application Using Material and Cupertino Widgets 5. Exploring Navigation and Routing with a Hacker News Clone 6. Building a Simple Contact Application with Forms and Gesturess 7. Building an Animated Excuses Application 8. Build an Adaptive, Responsive Note-Taking Application with Flutter and Dart Frog 9. Writing Tests and Setting Up GitHub Actions 10. Index 11. Other Books You May Enjoy

Setting up the project

First of all, you need to create a top-level folder called test; this is where we’re going to spend most of our time. Then, you need to add a new dependency to the pubspec.yaml file since we’re going to use it in the next section. Once you’ve done this, your dev_dependencies should be as follows (if it’s the case, make sure that you update them to their latest versions):

dev_dependencies:
  dart_code_metrics: ^4.8.1
  flutter_lints: ^1.0.4
  flutter_test:
    sdk: flutter
  golden_toolkit: ^0.12.0

Finally, we need to create a useful widget that wraps a common configuration that’s required by all the widgets we’re going to test. Since the app is based on a material design, our class is going to wrap a MaterialApp and a Scaffold widget. Place this widget inside the test folder and name it whatever you want; for example, mock_wrapper.dart:

class MockWrapper...
lock icon The rest of the chapter is locked
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
Banner background image