Iframe Plugin for Flutter
A comprehensive Flutter plugin that provides cross-platform iframe functionality for Android, iOS, Web, Linux, Windows, and macOS.
Features
- Create iframes with customizable properties (width, height, allow, sandbox, etc.)
- Navigate to different URLs
- Reload iframe content
- Get current iframe URL
- Execute JavaScript in iframe context
- Control iframe visibility
- Full platform support (Android, iOS, Web, Linux, Windows, macOS)
Installation
Add iframe as a dependency in your pubspec.yaml file:
dependencies:
iframe: ^1.0.0
Usage
Import the package in your Dart code:
import 'package:iframe/iframe.dart';
Create an instance of the Iframe plugin:
final iframe = Iframe();
Create an iframe
await iframe.create(
url: 'https://flutter.dev',
width: 400,
height: 300,
allow: 'fullscreen',
sandbox: 'allow-scripts',
);
Navigate to a new URL
await iframe.navigate('https://dart.dev');
Reload the iframe
await iframe.reload();
Get current URL
String? currentUrl = await iframe.getCurrentUrl();
Execute JavaScript
await iframe.executeScript('document.title');
Control visibility
await iframe.setVisible(true); // or false
Platform Support
| Platform | Status |
|---|---|
| Android | ✅ |
| iOS | ✅ |
| Web | ✅ |
| Linux | ✅ |
| Windows | ✅ |
| macOS | ✅ |
Example
Check out the example directory for a complete sample app.
License
MIT