Google Summer of Code 2020 results

Google Summer of Code

Google Summer of Code (GSoC) is a global program focused on bringing student developers into open source software development. Students are sponsored by Google to work with a mentoring open source organization on a 3-month programming project during the summer.

In February we were thrilled to announce that the Dart team would be a mentoring organization in GSoC 2020. We ended up mentoring 5 projects, picked from more than 170 applications from students around the world. Today we’re excited to share our results, as described by the students who worked on the projects.

Generating dart:ffi bindings for Dart-C interop with package:ffigen

package:ffigen is an FFI generator that greatly reduces the effort of using dart:ffi by generating Dart bindings from C header files (.h).

To understand the need for this tool, consider LibClang (the C interface to Clang). LibClang’s API is about 8,000 lines of code (LOC). If you were to write Dart bindings for LibClang by hand, you’d need almost 4,500 LOC. With package:ffigen, all you need to do is pass in a small YAML configuration file that’s less than 20 LOC, and then you can generate the bindings.

You can control which C functions to generate, and use simple regular expressions to rename macros, enums, and individual struct members. You can also generate array members nested in structs (which are not fully supported in dart:ffi yet).

Check out for a complete list of configurations, FAQs, examples, and more.

Learn testing with a new Flutter sample

Have you been using Flutter for a while but still haven’t figured out how to test Flutter apps? Then you might be interested in the sample that we built to demonstrate best practices for testing Flutter apps. You’ll be able to learn testing in Flutter in a quick and easy way.

The sample shows different types of testing including:

  • Unit testing
  • Widget testing
  • Integration testing
  • Performance testing
  • State management testing

As a bonus, we also built a codelab on how to test Flutter apps. You can see a detailed report of the work done under the project in the article Learn testing with the new Flutter sample.

User-extensible translation file formats

The intl_translation package supports only the ARB file format, which is not widely used outside of Dart. The intl_translation_format package, created during GSoC 2020, builds on intl_translation, adding a TranslationFormat class that can support widely varying formats. Developers can add support for additional formats in their own packages and in just a few lines create command-line tools for extraction and generation that integrate with the existing tools. With these, existing translations in other formats, even proprietary ones, can be imported into a Dart project easily and new messages originating in Dart code can be integrated into existing translation tools and workflows.

As a demonstration of these capabilities, the new packages include support for several formats. In addition to ARB, it supports XLIFF v1.2 (iOS), XLIFF v2.0, and JSON with ICU messages. Experimental libraries show how support for other formats, and even translations that can be updated at runtime, could be implemented.

Platform channels in a mobile app and a federated plugin

After researching platform channels (the Flutter API for sending messages back and forth from Dart to native code like Swift or Kotlin), we decided to cover the topic with two different samples. One is a straightforward Android and iOS demo, while the other is a federated plugin capable of building with the master channel for web and desktop as well. Between the two samples, the codebase shows off not only the details of platform channels and the codecs that can be used to move data, but also the APIs for federated plugins and techniques for calling native code on web and desktop (Windows and Linux) APIs.

If you’re a developer looking to build a plugin or just access a platform API, these samples are a great place to get started learning. For more information about this project, see the article Platform channel examples.

Writing package:yaml_edit to enable `pub add <package>`

Dart projects specify package dependencies in a pubspec.yaml file. YAML is great because it allows us to write comments, but programmatically modifying YAML is a challenge.

To tackle this challenge, we wrote package:yaml_edit to easily perform context-aware string manipulations that preserve formatting and comments. The test suite for the package contains more than 40,000 tests, and we think we have a pretty good solution working. Play with it and file bugs!

Using package:yaml_edit, we added a new pub add <package> subcommand to pub, the package management tool for Dart and Flutter. pub add automatically resolves for the latest compatible version of the target package and adds it to a user’s pubspec.yaml. To put this into perspective, pub add <package> automates the tedium of having to do all of the following:

  1. Visiting<package>
  2. Choosing a version to add to your package
  3. Modifying pubspec.yaml
  4. Running pub get
  5. Repeating steps 2-4 as many times as needed to get a version compatible with your other dependencies

A similar command that removes dependencies — pub remove <package>— is also in the works. Keep your eyes peeled for these two commands coming to pub soon!

Huge thanks to everyone who applied for Google Summer of Code 2020 with Dart, and to the students who completed projects this year, and to the mentors who spent time every week to make this an awesome summer of code. We hope to see many of you students again as contributors throughout the Dart ecosystem.


Dart is a client-optimized language for fast apps on any platform.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store