Setting up Flutter Engine Development Environment 🛠⚙ 🔥
It has been quite a while now for us at Nuclei, working/experimenting with flutter and flutter web. As we all know, although flutter is quite stable now but it’s still in development and polishing phase, especially when it comes to flutter web, and many other new features that flutter has proposed to support in the long run. Having said that, its obvious that you may come across issues/bugs/inconsistencies while using flutter, but Thank God! it’s open source, so one can always fork the official repo, modify it and use it at their comfort. In order to have full control of the flutter framework and codebase, you may want to have full control over the flutter engine too, which implements Flutter’s core libraries, including animation and graphics, file and network I/O, accessibility support, plugin architecture, and a Dart runtime and compile toolchain. The Flutter Engine is maintained as another separate repo.
In order to get hands on the flutter engine code, one can set up a flutter engine development environment, locally.
Following are the required steps:
- Fork
https://github.com/flutter/engine
into your own GitHub account. - Do Not clone it manually. Scripts will take care of that.
- Configure your machine with SSH keys known to git-hub if not already done.
- Create a new directory with name engine locally in your system, with a file named .gclient in the engine directory with the following content:
solutions = [
{
"managed": False,
"name": "src/flutter",
"url": "git@github.com:<your_github_username_here>/engine.git",
"custom_deps": {},
"deps_file": "DEPS",
"safesync_url": "",
},
]
5. Run a command gclient sync
in that directory. This will fetch all the source code that Flutter depends on. Avoid interrupting this script, as doing so can leave your repository in an inconsistent state that is tedious to clean up. (This step automatically runs git clone
, among other things) Add Chromium deptools to your path, which exposes gclient, to use it as a command.
6. Add a remote for the upstream repository:
cd src/flutter
which was created in yourengine
directory bygclient sync
.git remote add upstream git@github.com:flutter/engine.git
(So that you fetch from the masterflutter/engine
repository, not your clone, when runninggit fetch
)cd ..
(Return to thesrc
directory thatgclient sync
created in yourengine
directory.)
7. If you’re on Mac -> Install Oracle’s Java JDK, version 1.8 or later.
Compiling the local engine and using the engine build for testing:
Compiling the Engine
How to use flutter tools to compile the engine
Above were the few points, which did the job for us for MacOS.
For more detailed picture on setting up the environment and OS specific setup needs refer the following:
Support with claps, if the content here, helps you in anyway.
Till the next one. Happy Reading! :)