Integrate native SDKs in flutter project

Updated 21 December 2023

Save

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.

Platform Channel:

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.

Output:

Conclusion:

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/

author
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


2 comments

  • Roberto
    • nausheen Siddiqui (Moderator)
  • Start a Project


      Message Sent!

      If you have more details or questions, you can reply to the received confirmation email.

      Back to Home