본문 바로가기

kIsWeb2

내 Flutter 앱이 웹에서 실행 중인지 어떻게 감지할 수 있나요?, How can I detect if my Flutter app is running in the web? 질문 나는 Platform.isAndroid, Platform.isIOS 등으로 운영 체제를 감지할 수 있다는 것을 알고 있지만, Platform.isWeb와 같은 것은 없기 때문에 이를 감지하는 방법은 무엇인가요? 답변 글로벌 부울 변수 kIsWeb가 있으며 이 변수는 앱이 웹에서 실행될 수 있는지 여부를 알려줍니다. 문서: https://api.flutter.dev/flutter/foundation/kIsWeb-constant.html import 'package:flutter/foundation.dart' show kIsWeb; if (kIsWeb) { // 웹에서 실행 중! } else { // 웹에서 실행되지 않음! 여기에서 추가 플랫폼을 확인할 수 있습니다. } 2023. 5. 30.
flutter 다트 코드에서 호스트 플랫폼을 어떻게 감지하나요?, How do you detect the host platform from Dart code? 질문 For UI that should differ slightly on iOS and Android, i.e. on different platforms, there must be a way to detect which one the app is running on, but I couldn't find it in the docs. What is it? UI가 iOS와 Android에서 약간 다른 경우, 즉 다른 플랫폼에서는 응용 프로그램이 실행 중인 플랫폼을 감지하는 방법이 있어야하지만 문서에서 찾을 수 없었습니다. 그것은 무엇입니까? 답변 import 'dart:io' show Platform; if (Platform.isAndroid) { // Android-specific code } else if.. 2023. 5. 8.