Regarding OkHttp integration

117 views
Skip to first unread message

DHRUV PATIDAR

unread,
Apr 1, 2024, 9:45:07 AMApr 1
to dart-gsoc
Write a flutter plugin that wraps the OkHttp package using package:jnigen and implements the package:http Client interface. Time permitting, the plugin will also implement the package:web_socket_channel WebSocketChannel interface. This will allow us to provide several features requested by our users such as:

can any body clarify me , that if we can just generate the bindings from the OkHttp package using jnigen in one go , Then what is hard in this ? Everyone can do this . 

Please give me some guidence regarding this , i am gonna work on this beside the GSOC .

Bahaa Fathi

unread,
Apr 3, 2024, 4:34:34 PMApr 3
to dart-gsoc

Well, I believe it's not as straightforward as it might seem. I think the challenge lies in:

  • Understanding the actual problem we're facing, such as why we need to use OkHttp when we already have dart:io HttpClient.
  • Once you grasp the underlying issues, you'll realize why we need to address them.
  • Then you will see that the Dart team found they couldn’t implement these futures in dart:io HttpClient without significant effort, so they decided to rely on the OkHttp package through JNI calls.
  • Subsequently, you'll need to dive deep into understanding and familiarizing yourself with FFI, JNI, JNIGEN, and their theoretical workings. This might even involve diving into how these packages are put together.
  • Next, you'll have to study the implementation details of the package:http library and learn how to write a new Client.
  • Finally, you will start writing your new HTTP client, which relies on OkHttp. However, during this step, you will encounter numerous issues with the jnigen package due to its experimental nature and potential concurrency problems.

So I think, while it might appear simple at a glance, there's actually a complex process involved. It's akin to discovering a hidden mountain beneath the water.

Reply all
Reply to author
Forward
0 new messages