android_web_view_check 1.0.9+10
android_web_view_check: ^1.0.9+10 copied to clipboard
Provides version upgrade due to webview call error when using webview in Android
example/lib/main.dart
import 'package:android_web_view_check/android_web_view_check.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter web_view_check',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Flutter web_view_check'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
final int _counter = 0;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headlineMedium,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: checkDevice,
child: const Icon(Icons.check),
),
);
}
void checkDevice() async {
String val = await AndroidWebViewCheck().deviceCheck();
// 디바이스 WebView 버전을 판단해 90이하면 업데이트 스토어 이동 (90 이하면 웹뷰호출이 안됨)
if (val == "update") {
AndroidWebViewCheck().updateWebView();
}
}
}