Flutter webview_flutterを使用する方法
環境
Windows11 pro 64bit
Flutter 3.3.7
操作方法
1.pubspec.yamlでパッケージを追加します。
dependencies:
webview_flutter: ^3.0.4
2.パッケージをインポートします。
import 'package:webview_flutter/webview_flutter.dart’;
3.Androidを使用する場合、「project > android > app > build.gradle」で、SDKの最小バージョンを19以上にします。
defaultConfig {
applicationId "com.example.sample_app"
minSdkVersion 20
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
defaultConfig {
applicationId "com.example.sample_app"
minSdkVersion 20
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
defaultConfig { applicationId "com.example.sample_app" minSdkVersion 20 targetSdkVersion 30 versionCode flutterVersionCode.toInteger() versionName flutterVersionName }
4.WebView()を配置します
WebView(
initialUrl: 'url',
),
WebView(
initialUrl: 'url',
),
WebView( initialUrl: 'url', ),