FlutteriOSAndroid

A Journey with Flutter Native Plugin Development for iOS and Android

2021-06-04 · 7 min read · by Ishaq Hassan

Building cross-platform plugins for iOS and Android from scratch. Code, pitfalls, real examples from a published plugin author.

Read on

Read on Medium โ†’

Key takeaways

Frequently asked questions

MethodChannel vs PlatformView: which to use?

MethodChannel for one-off function calls and data exchange. PlatformView only when you need to embed an actual native UIView or Android View inside the Flutter widget tree.

How do I debug native plugin crashes?

On iOS, attach Xcode to the running iOS device or simulator and watch the console. On Android, run flutter logs while the app runs and look for native stack traces alongside Dart errors.

Should I write Swift or Objective-C for the iOS side?

Swift in 2024+. Objective-C is only worth it if you must support an old codebase. The Flutter plugin template defaults to Swift now.

How do I publish a native plugin?

Same flow as any pub.dev package: dart pub publish from the plugin root. Make sure your example app builds on both platforms before publishing or your pub score takes a hit.