반응형
- 패키지 설치
- 터미널 설치
flutter pub add url_launcher
- android / app / src / main / AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.flutter.example">
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https" />
</intent>
</queries>
<application
...
</application
</manifest>
- ios / Runner / Info.plist
<key>LSApplicationQueriesSchemes</key>
<array>
<string>https</string>
</array>
- 코드 예시
import 'package:url_launcher/url_launcher.dart';
import 'package:flutter/material.dart';
class ExamplePage extends StatefulWidget {
const ExamplePage({Key? key}) : super(key: key);
@override
State<ExamplePage> createState() => _ExamplePageState();
}
class _ExamplePageState extends State<ExamplePage> {
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: ElevatedButton(
child: Text(
"URL 열기",
),
onPressed: () {
launchUrl(Uri.parse('https://pub.dev/packages/url_launcher'));
},
),
));
}
}
참고할만한 글
반응형
'개발 > Flutter' 카테고리의 다른 글
플러터 Flutter if else문 간단 구현법 (0) | 2023.02.18 |
---|---|
플러터 Flutter 메모장 구현하기 Notepad (0) | 2023.01.29 |
플러터 Flutter ToDo List 구현하기 (0) | 2023.01.29 |
Flutter 플러터 타이머 간단 구현 Timer (0) | 2023.01.29 |
Flutter 플러터 화면 전환 애니메이션 삭제 간단 사용법 Navigator Animation (0) | 2022.12.25 |
Flutter 플러터 백 버튼 무시하기 WillPopScope (0) | 2022.12.25 |
Flutter 플러터 랜덤 숫자 간단 사용법 Random (0) | 2022.12.24 |
Flutter 플러터 앱 상태 확인하기 AppLifecycleState (0) | 2022.12.24 |
댓글