Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 22.214.171.124 release ready!
Updated 21 December 2023
Flutter provides different dependencies for achieving different features in your Flutter app. However, some libraries might not be available in Flutter or might not be as good as native SDKs. So, we Integrate native SDKs in the Flutter project.
Today, I am going to integrate the native iOS SDK “Folio Reader kit” in a flutter project using the method channel. There are different libraries available in Flutter for opening an epub file but this one fits my requirements.
You can also read more about Flutter app development services from Mobikul.
Now, let’s check how can we integrate native SDK in a Flutter project.
Create a new flutter project & add a button on the screen.
Now we are going to use Platform Channel to communicate between UI & platform.
A platform channel is a flexible messaging API between a Flutter app and the platform hosting the app. It’s how you can communicate with native and 3rd-party APIs.
From the official doc: “Messages are passed between the client (UI) and host (platform) using platform channels.“
Define a channel name on the dart side:
Invoke the channel when required, i.e. on the tap of the button.
We have added an ebook for extension .epub in our Flutter project assets. Now, we will pass this ebook path in our method as an argument & will use this on our iOS side.
Add iOS-specific Implementation:
Add folio reader SDK pod in your pod file & run the command “pod install”. You can get this SDK from this git link: https://github.com/FolioReader/FolioReaderKit
Now add this code to your App Delegate & import Folio Reader Kit.
We have fetched the path of the asset in Swift & used it to open our book using the Folioreader Kit in FlutterView Controller & present our reader screen.
In this article, I have explained how to integrate native SDKs into the Flutter project.
Thanks for reading this article.
If I got something wrong, let me know in the comments. I would love to improve.
For more interesting blogs check out here – https://mobikul.com/blog/
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.