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 3.0.3.7 release ready!
Deniel Kerr
Founder. Opencart
Top Partners
Dart package that contains an API written in Dart code combined with one or more platform-specific implementations. Plugin packages can be written for Android (using Kotlin or Java), iOS (using Swift or Objective-C), web, macOS, Windows, or Linux, or any combination thereof.Flutter allows us to create our own plugins where we can manage our native code.
Read about the variety of Flutter App Development Services offered by Mobikul
Let’s create a plugin where we will implement webview.Step 1: Create the package
Open the android studio got to File –>> New –>> New flutter project.
Click on the New flutter project –>> Select the Flutter plugin option and create the plugin.
Step 2: Specifying a plugin’s supported platforms. In pubspec.yaml file we can add specific information about the package.
Step 3: Now open lib/WebviewPlugin.dart file and create a method where we will pass URL string.
Step 4: Now implement Webview code in iOS end. Open SwiftWebviewPlugin.swift file from ios folder and add code to handle API request.
And Add WKWebview implementation code.
Step 5: Now implement Webview code in Android end. Open WebviewPlugin.kt file from android folder and add code to handle API request.
Now add WebViewActivity code in the package
webview.xml:
Step 6: Thats all for the implemention part, now call the openWebview method.
Step 7: Now publish the plugin.
Run the publish command in dry-run mode to see if everything passes analysis:
The next step is publishing to pub.dev:
I hope this code will help you better to understand Custom Plugin in Swift. If you feel any doubt or query please comment below.
Thanks for the read this blog and if you want to visit my other blog click here.
Your email address will not be published. Required fields are marked*
Name*
Email*
Save my name email and website in this browser for the next time I comment.
Hi, sorry for the typo.
It is WebviewPlugin.kt(kotlin file).
We have updated the blog now.
We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies. Learn more about privacy policy
Webkul is a truly trusted and supported IT Company to develop business ideas for e-commerce. They provide professional support after deploying the solution to production and be responsible to act for fixing the reported issues or system errors. We highly encourage to deal with Webkul for business development.
Hussein Zawia
Co-founder, 24Dokan
USA
India
Global
Name
Email
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.