Rethinking Dart interoperability with Android

Поділитися
Вставка
  • Опубліковано 5 вер 2024
  • In the past, Flutter only supported integration with Android libraries through a message-based approach called platform channels. With a new command using JNI to bridge to Android system APIs, Flutter developers can easily access platform APIs without needing to use a platform channel or plugin. This session will dive deeper into how Dart automatically creates bindings for cross-language interoperation and demo how to call a Jetpack Library directly from Dart in a Flutter app.
    Resources:
    Java interop → goo.gle/3GilmDA
    Full sample code → goo.gle/3KfwORI
    Demo code → goo.gle/3KAvp9O
    File issues and share feedback → goo.gle/3KU4V3a
    Speakers: Mariam Hasnany, Hossein Yousefi
    Watch more:
    Watch all Flutter Sessions → goo.gle/IO23_f...
    Watch all the Technical Sessions from Google I/O 2023 → goo.gle/IO23_s...
    Watch more Mobile Sessions → goo.gle/IO23_m...
    All Google I/O 2023 Sessions → goo.gle/IO23_all
    Subscribe to Flutter! → goo.gle/FlutterYT
    #GoogleIO

КОМЕНТАРІ • 30

  • @flutterdev
    @flutterdev  Рік тому +9

    Watch all Flutter Sessions → goo.gle/IO23_flutteryt_pin

  • @fodedoumbouya9731
    @fodedoumbouya9731 Рік тому +7

    Wow 🎉🎉🎉🎉
    Flutter is going far and deep 👏👏👏

  • @Arash7m
    @Arash7m Рік тому +2

    Hossein Yousefi is so well spoken!

  • @noahr842
    @noahr842 Рік тому +2

    I'm really glad to see this progress in this area. 🎉

  • @daniyaldolare3782
    @daniyaldolare3782 Рік тому +5

    Why didn't they use jnigen for the flutter camera plugin?

    • @mariamhasnany9052
      @mariamhasnany9052 Рік тому +20

      JNIgen is still experimental and pigeon made sense for our rewrite for the camera plugin (we wanted to release with 3.10) to use CameraX api because it kept our implementation and architecture the same for the plugin used across multiple platforms. If Camera plugin was only for Android usage, JNIgen would have made more sense. As JNIgen becomes more stable we will do a better job of explaining when to use JNIgen vs pigeon vs method channels.

    • @user-kn5bn7cd5s
      @user-kn5bn7cd5s Рік тому

      its pretty confusing for native developer to write native code in dart

  • @PieroDiVita
    @PieroDiVita 26 днів тому

    Great video, can't wait to try something to test it with!

  • @PenguinCrayon269
    @PenguinCrayon269 Рік тому +4

    what is the difference between platform channel and jnigen?

    • @mariamhasnany9052
      @mariamhasnany9052 Рік тому +4

      with platform (method) channels you have to write both Dart code for the Android API and a bunch of platform-specific code for handlers to send a receive messages from dart to native. JNIgen automatically generates Dart bindings for Android APIs available in Java or Kotlin code. After generating the bindings, you can go ahead and call the API like any other Dart code without needing to write any handlers because the bindings do that for you.

  • @madurangakannangara
    @madurangakannangara 10 місяців тому

    Excellent! There're much capabilities already in the Java space. The more we can use them through Dart, better/faster the applications would be able to ship to the customer!

  • @markthomas9181
    @markthomas9181 Рік тому +4

    Wow this is so cool.

  • @saqqara6361
    @saqqara6361 Рік тому +3

    Great, but how to include the other platforms like Windows, Mac, Linux, Web this way?

  • @techwithdipufrom0ton621
    @techwithdipufrom0ton621 10 місяців тому

    Great great team of Flutter and Dart. I ❤ this community

  • @MrUbervan
    @MrUbervan Рік тому +1

    Tem diferença entre canal e a chamada plataforma ?

  • @_yogeshsingh
    @_yogeshsingh Рік тому +2

    amazing 🎉

  • @user-nu2nj7mf2z
    @user-nu2nj7mf2z Рік тому +2

    very good

  • @user-mh4sz7yu1p
    @user-mh4sz7yu1p Рік тому +2

    cool!

  • @sidhu-patil
    @sidhu-patil 5 місяців тому

    Great 😃

  • @yogarelaxmusic8871
    @yogarelaxmusic8871 10 місяців тому

    do you have any reference video for the pigeon to work with C++ library? couldn't find enough to understand better?

  • @bennguyen1313
    @bennguyen1313 Рік тому

    Not sure the difference between a Flutter Plugin vs Package, but I'd like to make a Flutter Windows/Desktop application that can access peripherals via their DLL drivers/library.
    From what I've seen FFI/JNIGen , Pigeon, or platform-channels must be used, but not sure how. For example, the DLL exports functions that return pointers to structures (that in turn have enums and other structures as its member elements). Would love to see such a hello-world style Flutter (3.11?) application!

  • @inazumaeleven738
    @inazumaeleven738 Рік тому +1

    will the final apk contain all the methods or only the ones that were used?

    • @uhossein
      @uhossein Рік тому

      It will contain no classes/method by default in the release mode since they're all going to be tree-shaken. You will have to manually add the classes and methods you want to keep using proguard rules. We have an open issue to automatically generate the proguard rules in the future.

  • @dmitriykarbovskiy1790
    @dmitriykarbovskiy1790 Рік тому +2

    Finally.

  • @gofudgeyourselves9024
    @gofudgeyourselves9024 Рік тому +3

    Show an ios example with swift as well

  • @andreyrezende4221
    @andreyrezende4221 Рік тому

    awesome feature

  • @orjiemmanuel6442
    @orjiemmanuel6442 Рік тому +2

    👏👏👏👏👏

  • @AIGameMonster
    @AIGameMonster Рік тому

    It would be great if you can call Compose directly and cross-platform. I didn’t find such an example code.

  • @blekel
    @blekel Рік тому

    Неужели случилась друидская магия и Android либы теперь можно использовать на iOS, десктопе и вебе?
    Но подождите, ведь на видео они запускают только Android эмулятор.
    Если это другой вариант, как можно написать код только для одной платформы, то я даже не знаю, смеяться над этим или плакать - это "грабли" для потери времени в самом чистейшем виде.