Rethinking Dart interoperability with Android

Поделиться
HTML-код
  • Опубликовано: 9 май 2023
  • 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_flutter
    Watch all the Technical Sessions from Google I/O 2023 → goo.gle/IO23_sessions
    Watch more Mobile Sessions → goo.gle/IO23_mobile
    All Google I/O 2023 Sessions → goo.gle/IO23_all
    Subscribe to Flutter! → goo.gle/FlutterYT
    #GoogleIO
  • НаукаНаука

Комментарии • 29

  • @flutterdev
    @flutterdev  Год назад +9

    Watch all Flutter Sessions → goo.gle/IO23_flutteryt_pin

  • @noahr842
    @noahr842 Год назад +2

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

  • @fodedoumbouya9731
    @fodedoumbouya9731 Год назад +6

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

  • @Arash7m
    @Arash7m Год назад +2

    Hossein Yousefi is so well spoken!

  • @markthomas9181
    @markthomas9181 Год назад +4

    Wow this is so cool.

  • @techwithdipufrom0ton621
    @techwithdipufrom0ton621 9 месяцев назад

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

  • @_yogeshsingh
    @_yogeshsingh Год назад +2

    amazing 🎉

  • @madurangakannangara
    @madurangakannangara 9 месяцев назад

    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!

  • @sidhu-patil
    @sidhu-patil 4 месяца назад

    Great 😃

  • @user-nu2nj7mf2z
    @user-nu2nj7mf2z Год назад +2

    very good

  • @MrUbervan
    @MrUbervan Год назад +1

    Tem diferença entre canal e a chamada plataforma ?

  • @user-mh4sz7yu1p
    @user-mh4sz7yu1p Год назад +2

    cool!

  • @andreyrezende4221
    @andreyrezende4221 Год назад

    awesome feature

  • @yogarelaxmusic8871
    @yogarelaxmusic8871 9 месяцев назад

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

  • @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 11 месяцев назад

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

  • @PenguinCrayon269
    @PenguinCrayon269 Год назад +4

    what is the difference between platform channel and jnigen?

    • @mariamhasnany9052
      @mariamhasnany9052 Год назад +3

      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.

  • @bennguyen1313
    @bennguyen1313 11 месяцев назад

    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!

  • @dmitriykarbovskiy1790
    @dmitriykarbovskiy1790 Год назад +2

    Finally.

  • @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.

  • @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 эмулятор.
    Если это другой вариант, как можно написать код только для одной платформы, то я даже не знаю, смеяться над этим или плакать - это "грабли" для потери времени в самом чистейшем виде.

  • @gofudgeyourselves9024
    @gofudgeyourselves9024 Год назад +3

    Show an ios example with swift as well

  • @saqqara6361
    @saqqara6361 Год назад +3

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