~/talk

Bridging the Gap: Understanding Method Channels for Flutter …

Talkat DroidKaigi 2024 · 2024-09-11..09-13· [flutter, android]
links:none on file
slides:none on file

Shows working code to call native battery APIs on Android (MainActivity) and iOS (AppDelegate) using a MethodChannel named command_test_battery and a Flutter function getBatteryLevel, returning a numeric battery level successfully. Covers creating method call handlers, using try/catch for PlatformException, avoiding blocking the channel, and when to pick event channels for sensor streams or basic message channels for bidirectional messages. Notes binary serialization via StandardMessageCodec, and recommends FFI only for heavy compute or reuse of native libraries.

AI-written summary · about

  1. 0:00Flutter Method Channels intro
  2. 2:52Platform channels overview
  3. 4:37Synchronous method channels
  4. 7:10Event and message channels
  5. 9:00Step-by-step implementation
  6. 13:19Best practices for channels
  7. 15:08Avoid native code integration
  8. 17:34Platform channels advantages
  9. 19:22Non-string data handling
  10. 21:29Migrate to platform channels
  11. 24:11Migrate existing code
  12. 26:20When to use FFIs
  13. 26:52Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.