Running Flutter on Xamarin
Switch branches/tags
Nothing to show
Clone or download
krdmllr and adamped WIP transpiler signature (#22)
* Added import/base class rewrite rules, better method signatures

* removed csharp writer

* initial work on namespace, class, method

* Added mixin interfaces/implementation

* finished mixins, restructured code into seperate files

* Added fiel generation

* Added complete mixin/abstract class implementations

* Added name formatting to fit c# code style

* fixing signatures

* Moved signature files to won folder, added body transpiling start points

* Added readme with placeholders

* Moved dart-sdk path to config

* Renamed body into implementation

* Remove old model
Latest commit 6508bb4 Nov 12, 2018

README.md

Flutter for Xamarin

This project has no affiliation with Microsoft, Google or the Xamarin or Flutter teams.

The project is designed to make the Flutter SDK available on the .NET Framework, initially with the supported platforms of:

  1. Xamarin.Android
  2. Xamarin.iOS
  3. UWP

There is no reason this couldn't also expand to any place where SkiaSharp is supported.

This project is never expected to be commercially viable, unless it is picked up or supported by a larger company. As it currently stands, this is just a fun side project, done by a bunch of developers in their spare time. We offer no support for solutions ever built with this framework, or any guarantee of completion.

Overview

To make this work, numerous components need to come together.

alt text

Transpiler

The transpiler, will convert the existing Flutter SDK (written in Dart) to CSharp, for consumption in .NET applications.

A custom DartReader (Parser) has been created. This creates a Model, that is passed to the CSharpWriter.

The CSharpWriter uses Rosyln to output the model in C#.

Bindings

Flutter Bindings will include the connection between SkiaSharp and the Flutter SDK. We will not be using the actual Flutter engine, though we may do in the future.

Due to previous exploratory work, the Flutter engine is difficult to integrate with since we need to expose many C++ level APIs. Due to how this is implemented in the Flutter engine currently, it would require certain modifications and would be difficult to keep in sync with the master repository.

Hence, we will map the calls directly to SkiaSharp and Harfbuzz to draw directly on a SkiaCanvas. I could regret this, we shall see :)

Shell

The Shell, is where the Skia Canvas is initialized and platform level events are collected, and sent through to the Bindings project.

Contributing

We welcome any help.

  1. We have a Slack Channel in XamarinChat. Its private, so tweet me @adpedley if you want to be added. Let me know your username.

  2. Decide which area you want to start work in. (Transpiler, Bindings, Platform Shell)

  3. Look at the Projects Board and/or Issues list. Pick any issue and ask for it to be assigned to you, by commenting on it.

If you don't know where to start, comment in the Slack channel what area you might like to work on, and we can recommend some.

Please note our Code of Conduct

Skills needed

  1. Experience in C# is essential.

  2. Experience in Dart and/or Rosyln is an advantage in dealing with the Transpiler

  3. Experience in Skia/SkiaSharp is an advantage in dealing with the Flutter Bindings

  4. Experience in Xamarin.Android, Xamarin.iOS and/or UWP is beneficial for working with the Shell

You can be on a Mac or Windows. This is a Visual Studio 2017 solution file and projects. Having at least the Xamarin components of Visual Studio is required when dealing with the Shell.

Only C#/.NET are used in this project. Though we do parse Dart files. No C++ or other language skills needed.

How to contribute

  1. Create a fork of this project. Then clone your fork locally.

  2. Create a new branch on your fork, per card. NOTE: Do not do work directly on the master branch.

  3. Once complete, submit a PR to this project repository.

  4. It will be reviewed and merged once reviewed.

Rebasing your fork

Over time, your fork will become out of date with the main repository. If you don't know how to rebase, this is a sample on how to do it through the command line.

  1. Open a Command Prompt or Terminal window

Only do these once

  1. Make sure you haven't already added an upstream by typing

    git remote -v

You should have something similar to

origin  https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)   
origin  https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
  1. Add upstream by typing this command:

    git remote add upstream https://github.com/adamped/xamarin.flutter.git

Do these every rebase

  1. Ensure the master branch is checked out.

    git checkout master

  2. Reset the master branch. This is just to confirm nothing is lurking there.

    git reset --hard HEAD

  3. Fetch the latest upstream

    git fetch upstream

  4. Rebase upstream on to master

    git rebase upstream/master

  5. Force push your new rebased master to your fork

    git push origin master --force

If you need to rebase a branch as well (complete the above steps, then do these as well)

  1. Checkout your branch (do not include the angle brackets with your branch name < > )

    git checkout <branch name>

  2. Rebase your branch

    git rebase master/<branch name>

  3. Force push your new rebased branch to your fork

    git push origin <branch name> --force

Help! It's all a mess

If things have gone wrong and you have already had an existing branch PR'd and merged (PLEASE NOTE YOU NEED IT MERGED INTO THIS REPOSITORY). Then you can just delete your fork, and create a new one. Sometimes it's an easier approach if things are a mess and you don't have work that needs to be saved. All your PR'd and merged contributions will still be existing and credited to you. You do not lose any contributions or credit for them, by deleting your fork. But they must be merged here first.

License

All code here is licensed under the MIT license