A cross-platform app can share its interface and still need platform-specific behavior. The difficult decision is how much operating-system detail should cross into the shared application.
I would keep that boundary small enough that the Flutter feature remains understandable without knowing every native implementation detail.
When does Flutter need a native integration?
Start by checking whether a maintained package already provides the required capability on your target platform. If it does, review its maintenance, permissions, lifecycle behavior and error reporting before writing a custom implementation.
Native work becomes useful when the product needs an operating-system capability that is missing, insufficiently exposed or unusually sensitive to application lifecycle behavior. The reason should be a specific requirement, not a general assumption that native code is always faster.
Flutter's platform-integration documentation describes message passing across the boundary and points new projects toward typed or generated integration approaches where appropriate. Choose the mechanism for the API and platform you actually need.
Design an application operation instead of exposing native internals
A broad interface that forwards arbitrary native commands is hard to validate and test. Prefer a small contract representing the task the Flutter feature needs.
For example, a document feature might request text extraction for an approved local file and receive extracted text, page references and a clear failure category. It does not need access to every native document API.
A proposed macOS document boundary can look like this:
Flutter document screen -> Typed integration contract
|
v
Swift PDFKit adapter
|
v
Text and page referencesThe contract should define input limits, cancellation, errors and ownership of long-running work. If the native side receives a file reference, specify what access it needs and how that access is scoped.
Handle lifecycle changes as part of the interface
A screen can disappear while native work continues. A response can arrive after a newer request has started. The app can move between foreground and background while either side still holds resources.
Agree on which layer owns the request and what happens when its owner goes away. A request identifier and explicit cancellation outcome are often easier to reason about than a global callback with no session context.
| Boundary case | Question the contract should answer |
|---|---|
| Native API rejects the operation | Which error reaches the feature? |
| Permission is denied | Can the app explain and recover? |
| Widget is disposed | Who cancels or ignores the result? |
| Two operations overlap | How are results associated with requests? |
| Platform lacks the capability | What fallback is available? |
Do not treat an empty string as every failure state. It can be impossible to distinguish an empty document from a failed extraction if both produce the same return value.
What my cross-platform work illustrates
On The Social App, my contribution included Flutter work and a native iOS offline-messaging layer, alongside backend and deployment responsibilities. That is a team product, not a claim that I independently built its entire application.
ChalkLens provides a different example: a Flutter desktop workflow that uses native macOS document capabilities alongside local AI. These projects demonstrate why the platform boundary can be part of ordinary product engineering rather than a sign that the shared framework failed.
The Social App case study and ChalkLens case study describe those scopes. Neither establishes a performance comparison between a Flutter implementation and a fully native replacement.
Test both the contract and the real platform behavior
Test the shared feature using predictable adapter results, including permission and cancellation failures. Then test the adapter on the actual supported platform. A mock proves how your feature handles a response; it does not prove the operating system will supply that response.
Keep a short compatibility record when platform updates affect the integration. An interface that worked on one OS version should not become an unsupported promise about every later version.
Questions about Flutter and native code
Should we rewrite the whole app when one feature needs native code?
Usually that decision deserves a broader assessment. A narrow integration may solve the requirement without replacing the shared product.
Can the native implementation be identical on iOS and Android?
The application contract may be shared, but platform APIs, permissions and lifecycle behavior can differ. Verify each implementation independently.
How should we choose between a package and custom code?
Compare the actual capability, maintenance burden, supported platforms and failure behavior. Owning custom code also means owning future platform changes.
Before adding another method to an integration interface, ask which user task requires it. That question helps keep a small native feature from becoming a second application hidden behind the Flutter UI.