Download flutter source

I’m using 1.22.2 here, using FVM managed packages, you can use other methods

FVM install 1.22.2Copy the code

Download aspect source code

It’s best to use Git to download it and switch branches (don’t download zip directly).

git clone https://github.com.cnpmjs.org/XianyuTech/aspectd.git
Copy the code

You can also use sourceTree

Install aspectd

  1. Switch to the git directory of flutter

Git is the source code we downloaded above, click into there is a.git directory

cd ${path-for-git-flutter}
Copy the code
  1. Merge git patch files from the AspectD source into the source project

Execute in the directory switched above:

git apply --3way xxx/aspectD/0001-aspectD.path
Copy the code

The 0001-aspectd.patch file is in the AspectD source code.

  1. Delete the cache files in the original Flutter SDK directory
rm bin/cache/flutter_tools.stamp
Copy the code
  1. Rebuild the new Flutter compilation tool:
flutter doctor -v
Copy the code

At this point the flutter_tools.stamp file is regenerated

Run the AspectD project

To run an AspectD project, you need to perform pub get in aspectd_impl, example, and the root directory

If the pub get is ok, you can execute the following command to get the project running

flutter run --debug --verbose
Copy the code

Hit the pit

The kernel specified in pubspec.yaml of the AspectD source code is

Dependency_overrides: git: url: [email protected]:alibaba-flutter/sdk.git ref: stable/v1.22.2 path: PKG /kernelCopy the code

But in practice, I have been unable to download the source code of Dart-Lang. According to the website, I can download the source code of Dart-Lang and specify the corresponding branch, but there is no corresponding branch.

Alibaba-flutter directory is changed to XianyuTech. The source code of the flutter directory is changed to XianyuTech. The source code of the flutter directory is changed to XianyuTech.

[email protected]:XianyuTech/sdk.git
Copy the code

Even if you change the correct address, it will still be difficult to download, so it is recommended to use local.

  1. Download ali’s modified Dart source code
git clone https://github.com/XianyuTech/sdk.git
Copy the code

If this can be directly successful you can directly look at the second step, I am not successful. Because it’s too big, there’s not enough cache

Shallow clone first, then fetch

git clone https://github.com/XianyuTech/sdk.git --depth 1
cd sdk
git fetch --unshallow
Copy the code

Clone only the master branch. If you want all branches, run the following command:

git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch -all
Copy the code

2. Switch to the ref specified in pubspec.yaml in the AspectD project

Git checkout stable/v1.22.2Copy the code

3. Local dependency in pubspec.yaml

dependency_overrides:
  kernel:
    path: /Users/wenxuemao/custom/flutter/sdk/pkg/kernel
Copy the code

This time the pub get is ok, execute flutter run –debug –verbose to start the project.

Refer to the article

Guide to Getting started with Flutter AspectD

AspectD for a Flutter Aop Solution (1)