跳至主要內容
蒼葉森林

蒼葉森林

標籤: Error

發佈於 4 10 月, 2020

Got error "Unhandled Exception: Bad state: No element…" when call "cameras.first" run on iOS Simulator

Reason

iOS Simulator CANNOT use Camera

Reference

  • flutter – availableCameras is empty in IOS but no problem in Android – Stack Overflow
  • How to access iOS simulator camera – Stack Overflow

發佈於 4 10 月, 2020

The await expression can only be used in an async function.

Wrong

void main() {
  final cameras = await availableCameras();
  runApp(MyApp());
}

Correct

Future<void> main() async {
  final cameras = await availableCameras();
  runApp(MyApp());
}

近期文章

  • Hello world!
  • 執行開發中 APP 時顯示「尚未信任開發者」
  • Got error "Unhandled Exception: Bad state: No element…" when call "cameras.first" run on iOS Simulator
  • The await expression can only be used in an async function.
  • Target of URI doesn't exist: 'package:camera/camera.dart'.

近期留言

  • 「A WordPress Commenter」在〈Hello world!〉發佈留言

彙整

  • 2021 年 1 月
  • 2020 年 10 月
  • 2020 年 9 月
  • 2017 年 9 月
  • 2017 年 8 月
  • 2013 年 5 月
  • 2012 年 11 月
  • 2012 年 2 月
  • 2011 年 11 月
  • 2011 年 10 月
  • 2011 年 9 月
  • 2011 年 2 月

分類

  • Bitnami
  • Flutter
  • Laravel
  • MySQL
  • Programming
  • Uncategorized

其他操作

  • 登入
  • 訂閱網站內容的資訊提供
  • 訂閱留言的資訊提供
  • WordPress.org 台灣繁體中文
本站採用 WordPress 建置