Chapter 2. A brief intro to Dart
This chapter covers
- Dart’s Hello, World!
- Anatomy of a Dart program
- Basic Dart syntax such as control flow, loops, and functions
- Object-oriented programming in Dart
- Using I/O Dart libraries
This book is about building mobile apps with Flutter. But you can’t write a Flutter app without learning a bit about the Dart programming language first. The good news is that Dart is also quite easy to pick up. If you’re already comfortable enough with Dart that you understand the following code block, you can skip this chapter:
class CompanyContext extends StateObject { final bool isLoading; String _companyId; CompanyContext({ this.isLoading = false, }); String get companyId => _companyId; void set companyId(String id) { _companyId = id; _initApp(); } factory CompanyContext.loading() => CompanyContext(isLoading: true); @override String toString() => 'CompanyContext{isLoading: $isLoading, _companyId: $_companyId}'; }