Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[proposal] Flutter plugin using dart:ffi #799

Closed
iapicca opened this issue Jan 7, 2021 · 6 comments
Closed

[proposal] Flutter plugin using dart:ffi #799

iapicca opened this issue Jan 7, 2021 · 6 comments

Comments

@iapicca
Copy link

iapicca commented Jan 7, 2021

Flutter is a popular framework for mobile (stable), web (beta) and desktop (dev) that ranks as 16th most starred repo on github

At the moment dart team seems to be too busy to implement http/3 in Dart
it would be great if quiche team, possibly with the help of the community could provide support for flutter

I see that quiche already provides support for android and ios but,
as dart:ffi allows interoperability with native code that seems to work well with rust [ references: 1, 2, 3]
an implementation through dart:ffi would be definitely offer better performances (in a nutshell allowing to do this instead of that)
and dart:ffi works also on desktop

thank you for your time

@LPardue
Copy link
Contributor

LPardue commented Jan 7, 2021

Can you simply use quiche via the C FFI? For instance, this is the approach that some folks have taken with Java, integrating quiche via quiche's C FFI and the JNI.

@iapicca
Copy link
Author

iapicca commented Jan 7, 2021

@LPardue thanks for the quic ;) ;) ;) answer

the interaction between native code and flutter still happens through the platform
but in short yes, you can directly interact with a native function

import 'dart:ffi'; // For FFI
import 'dart:io'; // For Platform.isX

final DynamicLibrary nativeAddLib = Platform.isAndroid
    ? DynamicLibrary.open("libnative_add.so")
    : DynamicLibrary.process();
    
/// [...]

final int Function(int x, int y) nativeAdd =
  nativeAddLib
    .lookup<NativeFunction<Int32 Function(Int32, Int32)>>("native_add")
    .asFunction();
    

(source)

as a matter of fact several db for flutter do exactly that
nevertheless I wouldn't use word simply
I believe that a bunch of abstraction is required as flutter is very much declarative

side note, I almost forgot that dart:ffi works also on desktop (initial post updated)

@LPardue
Copy link
Contributor

LPardue commented Jan 7, 2021

I'm not sure what the ask is. Plenty of folks are integrating quiche into different runtimes etc. That can be done independent of the quiche project needing to do anything.

@iapicca
Copy link
Author

iapicca commented Jan 7, 2021

I just think that it would be great if there was a quiche plugin for flutter
even better if it comes directly from quiche team

@iapicca iapicca changed the title [proposal] Flutter support via dart:ffi [proposal] Flutter plugin using dart:ffi Jan 7, 2021
@joe-getcouragenow
Copy link

Glad this has been raised because we are also looking at this area.

As far as i know, this would mean that they you are not dependent on the networking stack ?

Also would this mean that you must run http/3 on your server ? quiche supports http/2, fallbacks ?

Also would that get developers access to the new Web Transport P2P aspects via quiche ?

@LPardue
Copy link
Contributor

LPardue commented Aug 24, 2023

This proposal seems like something better developed and maintained by folks closer to the Flutter community.

@ghedo ghedo closed this as completed Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants