This Week in Dart - Issue 18
Hello fellow Dartisans! Welcome to the eighteenth issue of This Week in Dart! This issue is a little different and covers news from the past two weeks.
This Week in Dart's aim is to be a useful collection of changes and news from across the Dart ecosystem and its surrounding community.
To contribute to this and future issues, feel free to contribute on GitHub or suggest content for next week on GitHub discussions.
To discuss this week's issue, feel free to join us on the Unofficial Dart Community Discord in the #this-week-in-dart
channel.
Announcements
Releases
These last two weeks saw the release of Dart 2.18.5, a patch release with the following fixes and improvements:
- Fixed an error on private variable setters in mixins on Dart web (SDK issue #50119)
- Fixed the handling of type parameter nullability in factory constructors (SDK issue #50392)
To learn how to update your Dart version, check out Get the Dart SDK or download the update from the Dart SDK archive.
Breaking changes
A breaking change request has also been made this week and is open for review and feedback:
Head to the linked issue to learn more about the potential breaking change, the reasoning behind it, its impact, and potential mitigations. Feel free to leave comments or concerns.
Generally the Dart team strives to not make breaking changes, and to preserve compatibility of all Dart programs across stable Dart SDK releases, but sometimes breaking changes are needed or justified. To learn more about this process, see Dart SDK breaking change process.
Null safety
This is your reminder to migrate your packages and apps to sound null safety which is supported with a language version of 2.12 or later.
Sound null safety can bring many benefits to your projects and is required to maintain future compatibility with Dart and packages as they continue to evolve. To learn more about migrating, see Migrating to null safety.
Dart 3, planned for a mid-2023 release, will require sound null safety. To learn more, see the Dart 3 null safety tracking SDK issue.
Community updates
Discussions
- Immutable Collection Benchmarks
- How exactly does Dart compare performance-wise to other languages such as go and Java?
- Dart in backend??
- Dart benchmarks
- (Video) Dart Frog - Flying High with Flutter #87
- (Video) Records in Dart language 2.19 - sneak peek
Learning materials
- Calling anonymous functions immediately
- 6 Types of Constructors in Dart
- Generics In Dart - Learn Dart Programming
- Use ?? to convert null to false | Effective Dart programming
- Provide a tree-sitter grammar for new GitHub Search
Project releases
- package:pcanvas was released
A portable canvas that can work in many platforms, including Flutter, web, desktop, and in-memory images. - package:yet_another_json_isolate was released
Dart package for simple JSON parsing using isolates. - package:translations_cleaner was released
Package to remove unused keys in arb files, across all translations. - package:google_books_api was released
A library to help on the search for books using the Google Books API. - package:mimir was released
A powerful, reactive database with typo-tolerant full-text search and declarative queries. - package:chance_generator was released
A Dart package lets you create random strings, integers, and other things to help with repetitive tasks, especially when building automated tests or wherever else you require anything random. - package:pull_request_coverage was released
A CLI tool to verify the test coverage of a pull request only, ignoring the rest of the project.
Project updates
- Dart Code (for VS Code) v3.54.0 was released
- package:alfred v1.0.0 was released
- package:conduit v4.0.0 was released
- package:drift v2.3.0 was released
- package:envied v0.3.0 was released
- package:freezed v2.3.0 was released
- package:dart_code_metrics v5.1.0 was released
- package:intl_translation v0.18.0 was released
- package:build_verify v3.1.0 was released
- package:copy_with_extension_gen v5.0.0 was released
- package:dart_jsonwebtoken v2.6.0 was released
Dart SDK updates
53 unique authors have contributed 242 commits to the Dart SDK over the past two weeks.
The following are some handpicked, interesting changes:
- [dart2wasm] Generic function types
- [cfe] Inline set literal and collection transformations in inference visitor
- [dev_compiler] Add record types
- [vm, compiler] Misc RISC-V codegen tweaks
- [analyzer] Add byteStore option for build_resolvers client
- [cfe] Add parser support for switch expressions
- [analyzer] LSP 'get implementations': get lineInfo directly
- [vm/compare] Speed up internal one/two-byte strings comparisons
- [dartdev] contribute a
dart bug
command - [analyzer] Only search the same files for the same thing once
- [cfe] Initial support for view methods
Keep in mind, none of these changes are guaranteed to eventually land in a stable release.
Language updates and discussion
Specification, implementation, and tooling work has been continuing for records and patterns.
In terms of the specifications, the 2.18 and 2.19 releases of the patterns specification were released over these pasts two weeks with the following additions and changes:
- Exhaustiveness checking of switch elements
- No more ambiguity around
=>
in switch expression guards - Error if map patterns have duplicate keys
- Allow symbol literals in patterns
- Support for negative number literals
- Allow map patterns in pattern assignments in expression statements
- Allow symbol literals in patterns
Extracted from a larger type modifier proposal, a proposal for base
, interface
, and final
type modifiers was also introduced. These can be placed on classes and mixins to allow an author to control whether the type allows being implemented, extended, both, or neither. Read the feature specification for more information on their functionality and motivation.
To learn more about and contribute to discussion of these and other potential changes to the Dart language, visit the Dart language repository.
Package of the week
The package of the week is package:puppeteer!
package:puppeteer
is a port of the Puppeteer Node.js library to Dart which enables you to automate a Chrome or Chromium browser over the DevTools Protocol.
Many of things you can do in the browser manually can be done using Puppeteer through Dart code. Some common tasks that Puppeteer enables are:
- Generate screenshots and PDFs of pages
- Crawl a single-page application or generate pre-rendered content
- Automate form submission, UI testing, keyboard input, etc.
- Run your tests directly in the latest version of Chrome using the latest JavaScript and browser features.
Puppeteer enables extensive control and makes it easy, even automatically installing the Chromium binaries for you. It also allows you to run the browser in headless or "headful" mode, depending on your use case. If you need anything from the browser, look no further than package:puppeteer
.
To learn more about Puppeteer for Dart, visit its pub page where it has examples or its generated API docs.
Dart's package ecosystem is growing fast, and we want to help foster that growth. If you know of any great open source projects, let us know by suggesting a package on GitHub discussions.
Upcoming events
Check the Flutter Meetup Network and the Dart Language tag on Meetup to find an event near you or online and connect with other Dart developers!
Let us know about future events on the events discussion board to include here!
Quotes and notes
Share quotes and comments you see or hear about Dart on our quotes discussion board for future inclusion!
Dart jobs
If you know of any jobs which use or are related to Dart, let us know in the Job postings for Dart discussion board, and we will be happy to include them here!