Win32 runner - Run a Flutter app without needing a lick of C/C++ code. Just Dart

Overview

pub package Language

Experimental package for running Flutter apps from a Dart runner, instead of the C++ runner that is provided by default when you do flutter create.

You might use this to create a Windows Flutter app without requiring a C++ compiler on your system.

At present, this is not much more than a lightweight experiment. It doesn't currently support plugins or theme changes. It is therefore not recommended for use with production apps: it's more a proof-of-concept.

A sample app that uses it can be found in the example\ subdirectory. This can be used to run an existing Flutter app.

For example:

# Create a sample app
C:\src\win32_runner> cd ..
C:\src> flutter create simpleapp
C:\src> cd simpleapp

# Compile Flutter code and assets to the build\ subdirectory
C:\src\simpleapp> flutter assemble -dTargetPlatform=windows-x64 --output=build -dBuildMode=release release_bundle_windows_assets

# Compile Dart runner
C:\src\simpleapp> dart compile exe ..\win32_runner\example\flutter_run.dart -o flutter_run.exe

# Run Flutter app
C:\src\simpleapp> flutter_run

Sample results: image

You might also like...

Helper app to run code on Aliucord iOS via websocket.

aliucordebug A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if

Jan 25, 2022

Create dart data classes easily, fast and without writing boilerplate or running code generation.

Create dart data classes easily, fast and without writing boilerplate or running code generation.

Dart Data Class Generator Create dart data classes easily, fast and without writing boilerplate or running code generation. Features The generator can

Feb 28, 2022

A test driver for Flutter to do QA testing without sharing app source code.

Autopilot A test driver for Flutter to do QA testing without sharing app source code. It exposes a JSON API using an HTTP server running inside the ap

Dec 30, 2022

Flutter plugin to simply integrate Agora Video Calling or Live Video Streaming to your app with just a few lines of code.

Agora UI Kit for Flutter Instantly integrate Agora video calling or video streaming into your Flutter application. Getting started Requirements An Ago

Dec 16, 2022

Flutter Multi-platform allows developers to unleash their app to run on the wide variety of different platforms with little or no change.

Flutter Multi-platform allows developers to unleash their app to run on the wide variety of different platforms with little or no change.

Flutter Multi-platform sample Flutter Multi-platform allows developers to unleash their app to run on the wide variety of different platforms with lit

Dec 31, 2022

An E-Commerce application developed on Flutter, which helps to run the app on Android / IOS / Windows's OS / MacOS / Web Browser from a single codebase

An E-Commerce application developed on Flutter, which helps to run the app on Android / IOS / Windows's OS / MacOS / Web Browser from a single codebase

BuySmart An E-Commerce application developed on Flutter, which helps to run the app on Android / IOS / Windows's OS / MacOS / Web Browser from a singl

Oct 10, 2022

Learn how to build a tensorflow model on Techable Machine and then run it on flutter app.

Learn how to build a tensorflow model on Techable Machine and then run it on flutter app.

Ml With Flutter Learn how to build a tensorflow model on Techable Machine and then run it on flutter app. Youtube Tutorial Show Support Recommend Me O

Jan 3, 2023

Run your MIT App Inventor projects on (nearly) any operating system!

xaif Run your MIT App Inventor projects on (nearly) any operating system! This tool is in an early development phase, see the disclaimer below. Prereq

Oct 17, 2022
Comments
  • Compile error, maybe the dart sdk version ?

    Compile error, maybe the dart sdk version ?

    Info: Compiling with sound null safety
    lib/src/ffi.dart:23:5: Error: Can't create typedef from non-function type.
        = Pointer<NativeFunction<Void Function(Pointer<Uint8>, UintPtr, Pointer)>>;
        ^
    lib/src/ffi.dart:30:39: Error: Can't create typedef from non-function type.
    typedef FlutterDesktopMessageCallback = Pointer<
                                          ^
    lib/src/ffi.dart:44:50: Error: Can't create typedef from non-function type.
    typedef FlutterDesktopPixelBufferTextureCallback = Pointer<
                                                     ^
    lib/src/ffi.dart:50:50: Error: Can't create typedef from non-function type.
    typedef FlutterDesktopOnPluginRegistrarDestroyed = Pointer<
                                                     ^
    lib/src/ffi.dart:23:60: Error: Type 'UintPtr' not found.
        = Pointer<NativeFunction<Void Function(Pointer<Uint8>, UintPtr, Pointer)>>;
                                                               ^^^^^^^
    lib/src/ffi.dart:47:13: Error: Type 'UintPtr' not found.
                UintPtr, UintPtr, Pointer)>>;
                ^^^^^^^
    lib/src/ffi.dart:47:22: Error: Type 'UintPtr' not found.
                UintPtr, UintPtr, Pointer)>>;
                         ^^^^^^^
    lib/src/ffi.dart:192:31: Error: 'UintPtr' isn't a type.
                  Pointer<Uint8>, UintPtr)>>('FlutterDesktopMessengerSend');
                                  ^^^^^^^
    lib/src/ffi.dart:223:15: Error: 'UintPtr' isn't a type.
                  UintPtr,
                  ^^^^^^^
    lib/src/ffi.dart:254:15: Error: 'UintPtr' isn't a type.
                  UintPtr)>>('FlutterDesktopMessengerSendResponse');
                  ^^^^^^^
    lib/src/ffi.dart:79:4: Error: Couldn't find constructor 'UintPtr'.
      @UintPtr()
       ^^^^^^^
    lib/src/ffi.dart:89:4: Error: Couldn't find constructor 'UintPtr'.
      @UintPtr()
       ^^^^^^^
    lib/src/ffi.dart:103:4: Error: Couldn't find constructor 'UintPtr'.
      @UintPtr()
       ^^^^^^^
    lib/src/ffi.dart:107:4: Error: Couldn't find constructor 'UintPtr'.
      @UintPtr()
       ^^^^^^^
    lib/src/ffi.dart:80:16: Error: Field 'struct_size' requires exactly one annotation to declare its native type, which cannot be Void. dart:ffi Structs and Unions cannot have regular Dart fields.
      external int struct_size;
                   ^
    lib/src/ffi.dart:90:16: Error: Field 'message_size' requires exactly one annotation to declare its native type, which cannot be Void. dart:ffi Structs and Unions cannot have regular Dart fields.
      external int message_size;
                   ^
    lib/src/ffi.dart:104:16: Error: Field 'width' requires exactly one annotation to declare its native type, which cannot be Void. dart:ffi Structs and Unions cannot have regular Dart fields.
      external int width;
                   ^
    lib/src/ffi.dart:108:16: Error: Field 'height' requires exactly one annotation to declare its native type, which cannot be Void. dart:ffi Structs and Unions cannot have regular Dart fields.
      external int height;
                   ^
    lib/src/ffi.dart:120:53: Error: Field 'callback' requires exactly one annotation to declare its native type, which cannot be Void. dart:ffi Structs and Unions cannot have regular Dart fields.
      external FlutterDesktopPixelBufferTextureCallback callback;
                                                        ^
    lib/src/ffi.dart:194:39: Error: Expected type 'NativeFunction<Int32 Function(Pointer<FlutterDesktopMessenger>, Pointer<Int8>, Pointer<Uint8>, invalid-type)>' to be a valid and instantiated subtype of 'NativeType'.
     - 'NativeFunction' is from 'dart:ffi'.
     - 'Int32' is from 'dart:ffi'.
     - 'Pointer' is from 'dart:ffi'.
     - 'FlutterDesktopMessenger' is from 'package:win32_runner/src/ffi.dart' ('lib/src/ffi.dart').
     - 'Int8' is from 'dart:ffi'.
     - 'Uint8' is from 'dart:ffi'.
          _FlutterDesktopMessengerSendPtr.asFunction<
                                          ^
    lib/src/ffi.dart:227:48: Error: Expected type 'NativeFunction<Int32 Function(Pointer<FlutterDesktopMessenger>, Pointer<Int8>, Pointer<Uint8>, invalid-type, invalid-type, Pointer<NativeType>)>' to be a valid and instantiated subtype of 'NativeType'.
     - 'NativeFunction' is from 'dart:ffi'.
     - 'Int32' is from 'dart:ffi'.
     - 'Pointer' is from 'dart:ffi'.
     - 'FlutterDesktopMessenger' is from 'package:win32_runner/src/ffi.dart' ('lib/src/ffi.dart').
     - 'Int8' is from 'dart:ffi'.
     - 'Uint8' is from 'dart:ffi'.
     - 'NativeType' is from 'dart:ffi'.
          _FlutterDesktopMessengerSendWithReplyPtr.asFunction<
                                                   ^
    lib/src/ffi.dart:256:47: Error: Expected type 'NativeFunction<Void Function(Pointer<FlutterDesktopMessenger>, Pointer<FlutterDesktopMessageResponseHandle>, Pointer<Uint8>, invalid-type)>' to be a valid and instantiated subtype of 'NativeType'.
     - 'NativeFunction' is from 'dart:ffi'.
     - 'Void' is from 'dart:ffi'.
     - 'Pointer' is from 'dart:ffi'.
     - 'FlutterDesktopMessenger' is from 'package:win32_runner/src/ffi.dart' ('lib/src/ffi.dart').
     - 'FlutterDesktopMessageResponseHandle' is from 'package:win32_runner/src/ffi.dart' ('lib/src/ffi.dart').
     - 'Uint8' is from 'dart:ffi'.
          _FlutterDesktopMessengerSendResponsePtr.asFunction<
                                                  ^
    lib/src/ffi.dart:292:46: Error: Expected type 'NativeFunction<Void Function(Pointer<FlutterDesktopMessenger>, Pointer<Int8>, invalid-type, Pointer<NativeType>)>' to be a valid and instantiated subtype of 'NativeType'.
     - 'NativeFunction' is from 'dart:ffi'.
     - 'Void' is from 'dart:ffi'.
     - 'Pointer' is from 'dart:ffi'.
     - 'FlutterDesktopMessenger' is from 'package:win32_runner/src/ffi.dart' ('lib/src/ffi.dart').
     - 'Int8' is from 'dart:ffi'.
     - 'NativeType' is from 'dart:ffi'.
          _FlutterDesktopMessengerSetCallbackPtr.asFunction<
                                                 ^
    lib/src/ffi.dart:423:62: Error: Expected type 'NativeFunction<Void Function(Pointer<FlutterDesktopPluginRegistrar>, invalid-type)>' to be a valid and instantiated subtype of 'NativeType'.
     - 'NativeFunction' is from 'dart:ffi'.
     - 'Void' is from 'dart:ffi'.
     - 'Pointer' is from 'dart:ffi'.
     - 'FlutterDesktopPluginRegistrar' is from 'package:win32_runner/src/ffi.dart' ('lib/src/ffi.dart').
          _FlutterDesktopPluginRegistrarSetDestructionHandlerPtr.asFunction<
                                                                 ^
    Error: AOT compilation failed
    Generating AOT kernel dill failed!
    
    Dart SDK version: 2.17.0-49.0.dev (dev) (Sun Jan 23 14:30:49 2022 -0800) on "windows_x64"
    
    opened by lycstar 5
  • Multiple flutter instances in one process

    Multiple flutter instances in one process

    Hi, is it possible to run multiple flutter instances in one process?

    Recently i've asked you this question(https://github.com/timsneath/win32/issues/357) and you advised me to check this https://github.com/ilopX/win, so i went there and author told me that you've implemented this feature here, in this repository. image

    Can you provide an example of how yo do it? (Something like this):

    https://user-images.githubusercontent.com/63228361/153557733-cb477dfb-dc61-416f-bbd3-3bf0158cda30.mp4

    When i try to add new instance with this example project(https://github.com/timsneath/win32_runner/blob/main/example/win32_runner.dart), my app freezes with the main window and does no longer respond to any actions

    opened by kirill-21 1
  • RenderObject

    RenderObject "Hello World" not visible

    Hi! Not to need VS and all the C++ SDK to compile/build Flutter apps for Windows is lightweight .

    I tried to execute the RenderObject based SampleCode

    https://github.com/renlite/relflor/blob/master/render_sample_hello/lib/main.dart

    with win32_runner, but got an empty window. Does it only work with widget_tree?

    The compilition of the flutter app seems not to use IC. Will this change? C:\src\simpleapp> flutter assemble -dTargetPlatform=windows-x64 --output=build -dBuildMode=release release_bundle_windows_assets

    opened by renlite 1
Owner
Tim Sneath
By day I herd cats and build high-productivity tools for developers. By night I play with code.
Tim Sneath
Flutter Navigation - all types of navigation in flutter run main.tabBar.dart to see tabBar, and run main.dart to see the otheres

pop_up_bar A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if th

Michael Odumosu 0 Jan 1, 2022
Win32 registry - A package that provides a friendly Dart API for accessing the Windows registry

A package that provides a friendly Dart API for accessing the Windows registry.

Tim Sneath 20 Dec 23, 2022
A Gherkin parsers and runner for Dart and Flutter which is very similar to cucumber

flutter_gherkin A fully featured Gherkin parser and test runner. Works with Flutter and Dart 2. This implementation of the Gherkin tries to follow as

Jon Samwell 184 Nov 18, 2022
A flutter SerialPort library using win32 API.

serial_port_win32 A SerialPort library using win32 API. Getting Started Get Ports final ports = SerialPort.getAvailablePorts(); print(ports); /// resu

Yichen Zhao 18 Nov 20, 2022
Just collection of UI designs build with flutter. Can run on any mobile, web & desktop.

Flutter UI Designs True cross platform app runs on web, mobile & desktop Download Requirements to run locally Flutter stable v2.0.0+ Dart VM version:

Hamza Iqbal 222 Dec 28, 2022
Let's deliver Flutter app using Fastlane and self-hosted runner.

Flutter CICD - Let's deliver app using Fastlane and Github selfhosted runner About This project shows how to create a minimal configuration for buildi

Codigee 3 Nov 17, 2022
A Flutter mobile application built completely using DhiWise and Supabase without coding single line of code. With 100% system generated code

Flutter Expension Getting Started with Flutter ?? Generated with ❤️ from Dhiwise A Flutter mobile application built completely using DhiWise and Supab

DhiWise 11 Oct 23, 2022
Schedule & run Dart code in the background on both Android & iOS

flt_worker The flt_worker plugin allows you to schedule and execute Dart-written background tasks in a dedicated isolate, by utilizing the WorkManager

Yingxin Wu 26 Nov 27, 2022
A flutter plugin about qr code or bar code scan , it can scan from file、url、memory and camera qr code or bar code .Welcome to feedback your issue.

r_scan A flutter plugin about qr code or bar code scan , it can scan from file、url、memory and camera qr code or bar code .Welcome to feedback your iss

PengHui Li 112 Nov 11, 2022