Custom Platform Channel Development for Flutter iOS Apps

When integrating a Flutter app with native iOS APIs—CoreNFC, NetworkExtension for VPN, AVFoundation with custom session configurations—Dart packages often fall short. They either don't cover the required functions or lag two major SDK versions behind. In such cases, you write a Platform Channel manu

Development and support of all types of mobile applications:

Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1All 1734 services
Custom Platform Channel Development for Flutter iOS Apps
Complex
~3-5 days

Our competencies:

Frequently Asked Questions

Latest works

  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    897
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    784
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1216
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    1081
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    1004
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    599

When integrating a Flutter app with native iOS APIs—CoreNFC, NetworkExtension for VPN, AVFoundation with custom session configurations—Dart packages often fall short. They either don't cover the required functions or lag two major SDK versions behind. In such cases, you write a Platform Channel manually. Common implementation errors—double invocation of FlutterResult, eventSink leaks, ignoring thread safety—lead to crashes that are hard to debug. Order a turnkey Platform Channel development: we assess your project in one day and implement the channel handling all edge cases. This saves up to 40% of debugging time and guarantees stability on iOS 16+.

What is a Platform Channel in Flutter?

Platform Channel is a two-way communication mechanism between Dart code and native iOS code (Swift or Objective-C). It enables calling native APIs not directly accessible from Dart, such as reading NFC, controlling the camera via AVFoundation, or working with Keychain. The channel uses serialization via StandardMessageCodec and thread synchronization. Flutter documentation provides basic templates, but real projects require accounting for many nuances.

How to Choose the Right Platform Channel Type?

Flutter provides three channel types for different scenarios:

Type Principle When to Use Peculiarities
MethodChannel Request/response One-time calls: biometrics, Keychain Call FlutterResult strictly once
EventChannel Data stream from native to Dart Continuous data: sensors, Bluetooth Nil eventSink in onCancel
BasicMessageChannel Bidirectional exchange with custom codec Complex structures not fitting StandardMessageCodec Rare, only for non-standard binary protocols

For 80% of tasks, MethodChannel suffices. It's 2–3 times easier to debug than EventChannel. EventChannel is chosen when data arrives continuously—e.g., accelerometer readings every 100 ms. BasicMessageChannel is applied in exceptional cases.

Why is Proper FlutterResult Invocation Important?

FlutterResult is an Objective-C callback passed to Swift for the response. The main rule: call it exactly once. Calling it twice causes a runtime crash with message Call to FlutterResult callback after it has been released. A typical pitfall: the AVCaptureSession.startRunning method executes asynchronously and finishes on a background queue. If you don't dispatch the result via DispatchQueue.main.async, the response may arrive on an unexpected thread, leading to non-deterministic behavior. In 30% of projects we review, the double-call error appears.

channel.setMethodCallHandler { [weak self] call, result in guard call.method == "startCapture" else { result(FlutterMethodNotImplemented) return } self?.session.startRunning(completion: { success, error in DispatchQueue.main.async { if let error = error { result(FlutterError(code: "CAPTURE_ERROR", message: error.localizedDescription, details: nil)) } else { result(success) } } }) } 

How to Avoid Leaks with EventChannel?

FlutterEventSink must be nilified in onCancel:

final class SensorStreamHandler: NSObject, FlutterStreamHandler { private var motionManager = CMMotionManager() private var eventSink: FlutterEventSink? func onListen(withArguments arguments: Any?, eventSink events: @escaping FlutterEventSink) -> FlutterError? { eventSink = events motionManager.startAccelerometerUpdates(to: .main) { [weak self] data, _ in guard let data = data else { return } self?.eventSink?(["x": data.acceleration.x, "y": data.acceleration.y]) } return nil } func onCancel(withArguments arguments: Any?) -> FlutterError? { motionManager.stopAccelerometerUpdates() eventSink = nil // critical: without this, there will be accesses to a deallocated object return nil } } 

Omitting eventSink = nil means getting EXC_BAD_ACCESS after a few minutes of work. Our practice shows that this error occurs in 70% of projects without code review.

Serialization via StandardMessageCodec: Pitfalls

StandardMessageCodec supports Uint8List, which helps when transferring small binary data (image preview, encrypted payload). But for objects more complex than a dictionary, manual serialization is still needed. Attempting to pass Data directly without converting to FlutterStandardTypedData leads to silent failure: Dart receives null instead of data. Using ready-made solutions reduces the risk of such errors by 50%.

How to Test a Platform Channel in 3 Steps

  1. Write a Dart test with MockMethodCallHandler to simulate the native side's response. Verify your service correctly handles success and error.
  2. Isolate the Swift handler: create a mock for dependencies (e.g., AVCaptureSession) and test result invocation in different scenarios.
  3. Test integration on a real device—many iOS APIs (NFC, Bluetooth) are unavailable in the simulator.

What's Included

  • Contract documentation (methods, types, error codes).
  • Native Swift handler with unit test coverage (XCTest).
  • Dart service with typed API and mock handlers for testing.
  • Access to a repository with usage examples and README.
  • Support for 30 days after delivery (integration consultations).

Development Stages of a Platform Channel

Stage Description Duration
Contract design Define methods, arguments, error codes 0.5 day
Swift handler implementation Write thread-safe code 1–2 days
Dart typed API service Wrap MethodChannel in a service class 0.5 day
Edge case handling Device doesn't support feature, user denied permission 0.5–1 day
Unit tests (Dart + Swift) Isolated testing of each side 1–2 days
Real device testing Many iOS APIs unavailable in simulator 1 day

Total: 3–5 days. Simple MethodChannel for one system call — 2–3 days with tests. EventChannel with continuous data flow — 4–5 days. Pricing is quoted individually after requirements analysis. Get a consultation — we assess your project within a day.