Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Platform Channels - Flutter

Kendi J
August 08, 2023

Platform Channels - Flutter

In Flutter, platform channels provide a way to communicate between Flutter and the native platform (such as Android or iOS). They allow Flutter applications to invoke platform-specific code written in Java, Kotlin, Objective-C, or Swift, and receive responses or data from the native side.

Kendi J

August 08, 2023
Tweet

More Decks by Kendi J

Other Decks in Technology

Transcript

  1. Flutter is an open source framework by Google for building

    beautiful, natively compiled, multi-platform applications from a single codebase. Oh hey Flutter! Nairobi
  2. Fast Flutter code compiles to ARM or Intel machine code

    as well as JavaScript, for fast performance on any device. Pwani
  3. Mechanism used to establish communication between Flutter and the host

    platform. This involves sending message from the host platform to handle necessary logic expecting a success or failure response. Platform Channels Nairobi
  4. Method Channel • A named channel that process its message

    in asynchronous way. • Best for one-time task Event Channel • A named channel that process its message using stream. • Best for tasks that need frequent updates e.g motion sensor Major implementation Nairobi
  5. Method Channel - Geolocation - Alarm sensors - Notification sounds

    - Accessing device USSD - Android and/ iOS wear watches - Home Screen Widget. Use cases of Platform Channel Nairobi
  6. Method Channel - Geolocation - Alarm sensors - Notification sounds

    - Accessing device USSD - Android and/ iOS wear watches - Home Screen Widget. Use cases of Platform Channel Nairobi
  7. Pigeon Package • A code generation tool, which generates all

    code needed for communication between Dart and Native platforms. • Best suited for large scale applications. • Saves development time • It supports - Kotlin and Java - Swift and Objective-C - C++ Nairobi
  8. Foreign Function Interface (FFI) • This enables C APIs to

    be used directly from Dart on the same thread thus making it more of performant channel. • It supports languages that can be compiled to C in Dart like:- - Java - Swift - Objective-C - C++ - Rust - Go • Best suited for application that require high performance Nairobi