flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
165.59k stars 27.34k forks source link

[web] Func stops executing silently after accessing Firestore.instance #53012

Closed agordeev closed 4 years ago

agordeev commented 4 years ago

Steps to Reproduce

I got this simple func:

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  MyApp() {
    test();
  }

  void test() async {
    print('1');
    final collection = Firestore.instance.collection('mycollection');
    print('2');
  }

...
}

The output is:

Restarted application in 142ms.
1

After accessing Firestore.instance the function doesn't execute anything else. No warning, no error thrown.

That makes debugging hard.

flutter doctor ``` [✓] Flutter (Channel beta, v1.16.2-pre.26, on Mac OS X 10.15.3 19D76, locale en-RU) • Flutter version 1.16.2-pre.26 at /Users/andrey/flutter • Framework revision 3998549d52 (25 hours ago), 2020-03-20 06:07:25 -0700 • Engine revision fd60ddf751 • Dart version 2.8.0 (build 2.8.0-dev.16.0 5b21a43c55) [✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3) • Android SDK at /Users/andrey/Library/Android/sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-29, build-tools 28.0.3 • ANDROID_HOME = /Users/andrey/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 11.3.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 11.3.1, Build version 11C504 • CocoaPods version 1.8.4 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [!] Android Studio (version 3.5) • Android Studio at /Applications/Android Studio.app/Contents ✗ Flutter plugin not installed; this adds Flutter specific functionality. ✗ Dart plugin not installed; this adds Dart specific functionality. • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405) [✓] VS Code (version 1.43.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.8.1 [✓] Connected device (5 available) • Android SDK built for x86 • emulator-5554 • android-x86 • Android 8.1.0 (API 27) (emulator) • iPad • 8807f3e1632ff643cc3f92f0f207ae5a7d831121 • ios • iOS 13.3.1 • iPhone 11 Pro • E5040D43-B64A-41FD-B102-32C9A6EF43A8 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator) • Chrome • chrome • web-javascript • Google Chrome 80.0.3987.149 • Web Server • web-server • web-javascript • Flutter Tools ! Doctor found issues in 1 category. ```

My index.html looks this:

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <link rel="manifest" href="/manifest.json">
</head>
<body>

  <script src="https://www.gstatic.com/firebasejs/7.8.2/firebase-app.js"></script>
  <script src="https://www.gstatic.com/firebasejs/7.8.2/firebase-auth.js"></script>
  <script src="https://www.gstatic.com/firebasejs/7.8.2/firebase-firestore.js"></script>
  <script src="https://www.gstatic.com/firebasejs/7.8.2/firebase-functions.js"></script>
  <script src="https://www.gstatic.com/firebasejs/7.8.2/firebase-storage.js"></script>
  <script>
    var firebaseConfig = {...};
    // Initialize Firebase
    firebase.initializeApp(firebaseConfig);  
  </script>

  <!-- This script installs service_worker.js to provide PWA functionality to
       application. For more information, see:
       https://developers.google.com/web/fundamentals/primers/service-workers -->
  <script>
    if ('serviceWorker' in navigator) {
      window.addEventListener('load', function () {
        navigator.serviceWorker.register('/flutter_service_worker.js');
      });
    }
  </script>
  <script src="main.dart.js" type="application/javascript"></script>
</body>
</html>
iapicca commented 4 years ago

Hi @agordeev for what I can see the issue is related to a FlutterFire plugin, please open the issue in the dedicated github. Closing, as this isn't an issue with Flutter itself, if you disagree please write in the comments and I will reopen it thank you

agordeev commented 4 years ago

@iapicca I disagree. A plugin is not responsible for program flow and error handling/throwing.

iapicca commented 4 years ago

Hi @agordeev can you please provide youryour flutter run --verbose and your pubspec.yaml or if possible a reproducible minimal code sample. Thank you

agordeev commented 4 years ago

pubspec.yaml:

name: web_app
description: A new Flutter project.
version: 1.0.0+1

environment:
  sdk: ">=2.6.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  # App
  core:
    path: ../core
  shared:
    path: ../shared
  # data_access:
  #   path: ../data_access

  # Widgets
  badges:
  google_maps_flutter:

  # Misc
  provider: 
  flutter_bloc: 
  equatable: 
  universal_html:
  image: 
  intl:
  url_launcher:

  cloud_firestore:

dev_dependencies:
  flutter_test:
    sdk: flutter

# The following section is specific to Flutter.
flutter:
flutter run --verbose -d chrome ``` $ flutter run --verbose -d chrome [ +21 ms] executing: [/Users/user/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H [ +40 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H [ ] 3998549d529cb21488e5720a4c81cb20015e18e6 [ ] executing: [/Users/user/flutter/] git describe --match v*.*.* --first-parent --long --tags [ +20 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags [ ] v1.16.1-26-g3998549d5 [ +9 ms] executing: [/Users/user/flutter/] git rev-parse --abbrev-ref --symbolic @{u} [ +12 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u} [ ] origin/beta [ ] executing: [/Users/user/flutter/] git ls-remote --get-url origin [ +9 ms] Exit code 0 from: git ls-remote --get-url origin [ ] https://github.com/flutter/flutter.git [ +63 ms] executing: [/Users/user/flutter/] git rev-parse --abbrev-ref HEAD [ +12 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD [ ] beta [ +4 ms] executing: sw_vers -productName [ +13 ms] Exit code 0 from: sw_vers -productName [ ] Mac OS X [ ] executing: sw_vers -productVersion [ +13 ms] Exit code 0 from: sw_vers -productVersion [ ] 10.15.3 [ ] executing: sw_vers -buildVersion [ +13 ms] Exit code 0 from: sw_vers -buildVersion [ ] 19D76 [ +26 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update. [ ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update. [ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update. [ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update. [ +3 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update. [ +23 ms] executing: /Users/user/Library/Android/sdk/platform-tools/adb devices -l [ +6 ms] executing: /usr/bin/xcode-select --print-path [ +5 ms] Exit code 0 from: /usr/bin/xcode-select --print-path [ ] /Applications/Xcode.app/Contents/Developer [ ] executing: /usr/bin/xcodebuild -version [ +97 ms] Exit code 0 from: /usr/bin/xcodebuild -version [ ] Xcode 11.3.1 Build version 11C504 [ +2 ms] executing: xcrun --find xcdevice [ +7 ms] Exit code 0 from: xcrun --find xcdevice [ ] /Applications/Xcode.app/Contents/Developer/usr/bin/xcdevice [ ] executing: xcrun xcdevice list --timeout 1 [ +3 ms] /usr/bin/xcrun simctl list --json devices [ ] executing: /usr/bin/xcrun simctl list --json devices [ +37 ms] List of devices attached [ +75 ms] { "devices" : { "com.apple.CoreSimulator.SimRuntime.iOS-10-3" : [ ], "com.apple.CoreSimulator.SimRuntime.iOS-13-3" : [ { "state" : "Shutdown", "isAvailable" : true, "name" : "iPhone 8", "udid" : "BAD8210C-917F-43D2-A594-883C1880AB1F" }, { "state" : "Shutdown", "isAvailable" : true, "name" : "iPhone 8 Plus", "udid" : "ADBBE746-8D3F-42AB-AFAF-B1BA08DDE770" }, { "state" : "Shutdown", "isAvailable" : true, "name" : "iPhone Xs Max", "udid" : "CB00B9CC-98BF-4F3D-A5F8-975A07E5AE06" }, { "state" : "Shutdown", "isAvailable" : true, "name" : "iPhone 11", "udid" : "3355075F-790F-4637-85B0-7DAD1F822BBF" }, { "state" : "Shutdown", "isAvailable" : true, "name" : "iPhone 11 Pro", "udid" : "E5040D43-B64A-41FD-B102-32C9A6EF43A8" }, { "state" : "Shutdown", "isAvailable" : true, "name" : "iPhone 11 Pro Max", "udid" : "49E8A85F-CDFA-4DDD-BD94-BCE8F27669D1" }, { "state" : "Shutdown", "isAvailable" : true, "name" : "iPad (7th generation)", "udid" : "1CA482F7-BCDC-49B9-886A-A5F034A7DD0F" }, { "state" : "Shutdown", "isAvailable" : true, "name" : "iPad Pro (12.9-inch) (3rd generation)", "udid" : "798E1B10-95B3-4BEF-8E09-D6DE289924EB" } ], "com.apple.CoreSimulator.SimRuntime.iOS-12-4" : [ { "state" : "Shutdown", "isAvailable" : true, "name" : "iPhone 5s", "udid" : "164EB119-45C7-43B0-9221-3DA806406A3C" }, { "state" : "Shutdown", "isAvailable" : true, "name" : "iPhone 8", "udid" : "E8EC639C-21C2-4E48-878F-ED25F06D25AA" } ], "com.apple.CoreSimulator.SimRuntime.iOS-13-0" : [ { "state" : "Shutdown", "isAvailable" : false, "name" : "iPhone 8", "udid" : "0BB3B097-662B-4B47-8A2C-FB3137761CE0", "availabilityError" : "runtime profile not found" }, { "state" : "Shutdown", "isAvailable" : false, "name" : "iPhone 11 Pro", "udid" : "8C84D302-F4A5-4FCE-B32C-0817B7B8BE2B", "availabilityError" : "runtime profile not found" }, { "state" : "Shutdown", "isAvailable" : false, "name" : "iPhone 11 Pro Max", "udid" : "5C26A606-4824-454A-8018-4447F79B66A5", "availabilityError" : "runtime profile not found" } ], "com.apple.CoreSimulator.SimRuntime.watchOS-6-1" : [ { "state" : "Shutdown", "isAvailable" : true, "name" : "Apple Watch Series 4 - 40mm", "udid" : "D79EA95E-EB4E-4679-B9BF-B96A46E66ADA" }, { "state" : "Shutdown", "isAvailable" : true, "name" : "Apple Watch Series 4 - 44mm", "udid" : "D48A27CE-4AB1-4445-92A0-CEB8CE1951CC" }, { "state" : "Shutdown", "isAvailable" : true, "name" : "Apple Watch Series 5 - 40mm", "udid" : "EC927EEC-F2C6-4563-AA47-EBC4DDD36040" }, { "state" : "Shutdown", "isAvailable" : true, "name" : "Apple Watch Series 5 - 44mm", "udid" : "58A1EF70-F297-4F6D-8439-DE1AC38C2C42" } ], "com.apple.CoreSimulator.SimRuntime.tvOS-13-2" : [ { "state" : "Shutdown", "isAvailable" : false, "name" : "Apple TV", "udid" : "B664DE50-BF89-46EF-9C5C-CDB0B4755367", "availabilityError" : "runtime profile not found" }, { "state" : "Shutdown", "isAvailable" : false, "name" : "Apple TV 4K", "udid" : "8E7C99FB-548D-4EC6-B361-84B3622F677C", "availabilityError" : "runtime profile not found" }, { "state" : "Shutdown", "isAvailable" : false, "name" : "Apple TV 4K (at 1080p)", "udid" : "C717F236-C045-42D6-8F88-2097F2059E2A", "availabilityError" : "runtime profile not found" } ], "com.apple.CoreSimulator.SimRuntime.iOS-13-2" : [ { "state" : "Shutdown", "isAvailable" : false, "name" : "iPhone 8", "udid" : "D6C21B49-AC09-460D-BCA6-CAB165D367AD", "availabilityError" : "runtime profile not found" }, { "state" : "Shutdown", "isAvailable" : false, "name" : "iPhone 8 Plus", "udid" : "B98B8051-D45E-4839-857C-9AB0428D268E", "availabilityError" : "runtime profile not found" }, { "state" : "Shutdown", "isAvailable" : false, "name" : "iPhone 11", "udid" : "08E70193-271E-431D-BF87-53F8394ECABE", "availabilityError" : "runtime profile not found" }, { "state" : "Shutdown", "isAvailable" : false, "name" : "iPhone 11 Pro", "udid" : "40EFA57D-C7C8-437F-BB03-6FD19ECB4012", "availabilityError" : "runtime profile not found" }, { "state" : "Shutdown", "isAvailable" : false, "name" : "iPhone 11 Pro Max", "udid" : "B79FE8EE-7E02-443C-A148-B99D30A62ACA", "availabilityError" : "runtime profile not found" }, { "state" : "Shutdown", "isAvailable" : false, "name" : "iPad Pro (9.7-inch)", "udid" : "06ED7C4C-433D-4CCC-BDCE-9058F07E4687", "availabilityError" : "runtime profile not found" }, { "state" : "Shutdown", "isAvailable" : false, "name" : "iPad (7th generation)", "udid" : "596E9FE1-53E4-445F-A498-CCEA9B3A38FF", "availabilityError" : "runtime profile not found" }, { "state" : "Shutdown", "isAvailable" : false, "name" : "iPad Pro (11-inch)", "udid" : "4E70654C-C7FA-4EE8-8CD4-C70E3EABECF6", "availabilityError" : "runtime profile not found" }, { "state" : "Shutdown", "isAvailable" : false, "name" : "iPad Pro (12.9-inch) (3rd generation)", "udid" : "EA862A15-3252-4680-8ED8-93E5CB4F38B4", "availabilityError" : "runtime profile not found" }, { "state" : "Shutdown", "isAvailable" : false, "name" : "iPad Air (3rd generation)", "udid" : "447174D1-7C45-49BC-A080-5A68B26FE7DE", "availabilityError" : "runtime profile not found" } ], "com.apple.CoreSimulator.SimRuntime.tvOS-13-3" : [ { "state" : "Shutdown", "isAvailable" : true, "name" : "Apple TV", "udid" : "1C70D6CC-4C3F-41AF-A11F-2FA3369DD897" }, { "state" : "Shutdown", "isAvailable" : true, "name" : "Apple TV 4K", "udid" : "DBC8C3BD-0919-442D-80B6-778A8A8387FF" }, { "state" : "Shutdown", "isAvailable" : true, "name" : "Apple TV 4K (at 1080p)", "udid" : "3CA79A49-AB9A-4873-97B8-D650BAB4C134" } ] } } [+1431 ms] [ { "simulator" : true, "operatingSystemVersion" : "13.3 (17C45)", "available" : true, "platform" : "com.apple.platform.iphonesimulator", "modelCode" : "iPhone12,5", "identifier" : "49E8A85F-CDFA-4DDD-BD94-BCE8F27669D1", "architecture" : "x86_64", "modelName" : "iPhone 11 Pro Max", "name" : "iPhone 11 Pro Max" }, { "simulator" : true, "operatingSystemVersion" : "12.4 (16G73)", "available" : true, "platform" : "com.apple.platform.iphonesimulator", "modelCode" : "iPhone10,4", "identifier" : "E8EC639C-21C2-4E48-878F-ED25F06D25AA", "architecture" : "x86_64", "modelName" : "iPhone 8", "name" : "iPhone 8" }, { "simulator" : true, "operatingSystemVersion" : "6.1.1 (17S445)", "available" : true, "platform" : "com.apple.platform.watchsimulator", "modelCode" : "Watch5,3", "identifier" : "EC927EEC-F2C6-4563-AA47-EBC4DDD36040", "architecture" : "i386", "modelName" : "Apple Watch Series 5 - 40mm", "name" : "Apple Watch Series 5 - 40mm" }, { "simulator" : true, "operatingSystemVersion" : "13.3 (17C45)", "available" : true, "platform" : "com.apple.platform.iphonesimulator", "modelCode" : "iPad7,12", "identifier" : "1CA482F7-BCDC-49B9-886A-A5F034A7DD0F", "architecture" : "x86_64", "modelName" : "iPad (7th generation)", "name" : "iPad (7th generation)" }, { "simulator" : false, "operatingSystemVersion" : "13.3.1 (17D50)", "interface" : "usb", "available" : false, "platform" : "com.apple.platform.iphoneos", "modelCode" : "iPhone12,3", "identifier" : "00008030-001651000150802E", "architecture" : "arm64e", "modelName" : "iPhone 11 Pro", "name" : "user’s iPhone", "error" : { "code" : -13, "failureReason" : "", "underlyingErrors" : [ { "code" : 5, "failureReason" : "allowsSecureServices: 1. isConnected: 0. Platform: > . DTDKDeviceIdentifierIsIDID: 0", "description" : "📱 -- Failed _shouldMakeReadyForDevelopment check even though device is not locked by passcode.", "recoverySuggestion" : "", "domain" : "com.apple.platform.iphoneos" } ], "description" : "user’s iPhone is not connected", "recoverySuggestion" : "Xcode will continue when user’s iPhone is connected.", "domain" : "com.apple.platform.iphoneos" } }, { "simulator" : true, "operatingSystemVersion" : "6.1.1 (17S445)", "available" : true, "platform" : "com.apple.platform.watchsimulator", "modelCode" : "Watch5,4", "identifier" : "58A1EF70-F297-4F6D-8439-DE1AC38C2C42", "architecture" : "i386", "modelName" : "Apple Watch Series 5 - 44mm", "name" : "Apple Watch Series 5 - 44mm" }, { "simulator" : true, "operatingSystemVersion" : "13.3 (17C45)", "available" : true, "platform" : "com.apple.platform.iphonesimulator", "modelCode" : "iPhone11,4", "identifier" : "CB00B9CC-98BF-4F3D-A5F8-975A07E5AE06", "architecture" : "x86_64", "modelName" : "iPhone Xs Max", "name" : "iPhone Xs Max" }, { "simulator" : false, "operatingSystemVersion" : "12.3 (16M153)", "interface" : "usb", "available" : false, "platform" : "com.apple.platform.appletvos", "modelCode" : "AppleTV5,3", "identifier" : "c2089fc00183beb4963365f77757b993ccc4d3bf", "architecture" : "arm64", "modelName" : "Apple TV (4th generation)", "name" : "Apple TV (3139)", "error" : { "code" : -13, "failureReason" : "", "underlyingErrors" : [ { "code" : 5, "failureReason" : "allowsSecureServices: 1. isConnected: 0. Platform: >. DTDKDeviceIdentifierIsIDID: 0", "description" : "📱 -- Failed _shouldMakeReadyForDevelopment check even though device is not locked by passcode.", "recoverySuggestion" : "", "domain" : "com.apple.platform.iphoneos" } ], "description" : "Apple TV (3139) is not connected", "recoverySuggestion" : "Xcode will continue when Apple TV (3139) is connected.", "domain" : "com.apple.platform.iphoneos" } }, { "simulator" : true, "operatingSystemVersion" : "12.4 (16G73)", "available" : true, "platform" : "com.apple.platform.iphonesimulator", "modelCode" : "iPhone6,1", "identifier" : "164EB119-45C7-43B0-9221-3DA806406A3C", "architecture" : "x86_64", "modelName" : "iPhone 5s", "name" : "iPhone 5s" }, { "simulator" : true, "operatingSystemVersion" : "13.3 (17C45)", "available" : true, "platform" : "com.apple.platform.iphonesimulator", "modelCode" : "iPhone10,5", "identifier" : "ADBBE746-8D3F-42AB-AFAF-B1BA08DDE770", "architecture" : "x86_64", "modelName" : "iPhone 8 Plus", "name" : "iPhone 8 Plus" }, { "simulator" : true, "operatingSystemVersion" : "13.3 (17K446)", "available" : true, "platform" : "com.apple.platform.appletvsimulator", "modelCode" : "AppleTV6,2", "identifier" : "DBC8C3BD-0919-442D-80B6-778A8A8387FF", "architecture" : "x86_64", "modelName" : "Apple TV 4K", "name" : "Apple TV 4K" }, { "simulator" : true, "operatingSystemVersion" : "13.3 (17K446)", "available" : true, "platform" : "com.apple.platform.appletvsimulator", "modelCode" : "AppleTV5,3", "identifier" : "1C70D6CC-4C3F-41AF-A11F-2FA3369DD897", "architecture" : "x86_64", "modelName" : "Apple TV", "name" : "Apple TV" }, { "simulator" : true, "operatingSystemVersion" : "13.3 (17C45)", "available" : true, "platform" : "com.apple.platform.iphonesimulator", "modelCode" : "iPhone12,3", "identifier" : "E5040D43-B64A-41FD-B102-32C9A6EF43A8", "architecture" : "x86_64", "modelName" : "iPhone 11 Pro", "name" : "iPhone 11 Pro" }, { "simulator" : true, "operatingSystemVersion" : "13.3 (17C45)", "available" : true, "platform" : "com.apple.platform.iphonesimulator", "modelCode" : "iPad8,5", "identifier" : "798E1B10-95B3-4BEF-8E09-D6DE289924EB", "architecture" : "x86_64", "modelName" : "iPad Pro (12.9-inch) (3rd generation)", "name" : "iPad Pro (12.9-inch) (3rd generation)" }, { "simulator" : true, "operatingSystemVersion" : "13.3 (17C45)", "available" : true, "platform" : "com.apple.platform.iphonesimulator", "modelCode" : "iPhone10,4", "identifier" : "BAD8210C-917F-43D2-A594-883C1880AB1F", "architecture" : "x86_64", "modelName" : "iPhone 8", "name" : "iPhone 8" }, { "simulator" : true, "operatingSystemVersion" : "6.1.1 (17S445)", "available" : true, "platform" : "com.apple.platform.watchsimulator", "modelCode" : "Watch4,3", "identifier" : "D79EA95E-EB4E-4679-B9BF-B96A46E66ADA", "architecture" : "i386", "modelName" : "Apple Watch Series 4 - 40mm", "name" : "Apple Watch Series 4 - 40mm" }, { "simulator" : true, "operatingSystemVersion" : "6.1.1 (17S445)", "available" : true, "platform" : "com.apple.platform.watchsimulator", "modelCode" : "Watch4,4", "identifier" : "D48A27CE-4AB1-4445-92A0-CEB8CE1951CC", "architecture" : "i386", "modelName" : "Apple Watch Series 4 - 44mm", "name" : "Apple Watch Series 4 - 44mm" }, { "simulator" : true, "operatingSystemVersion" : "13.3 (17K446)", "available" : true, "platform" : "com.apple.platform.appletvsimulator", "modelCode" : "AppleTV6,2", "identifier" : "3CA79A49-AB9A-4873-97B8-D650BAB4C134", "architecture" : "x86_64", "modelName" : "Apple TV 4K (at 1080p)", "name" : "Apple TV 4K (at 1080p)" }, { "simulator" : true, "operatingSystemVersion" : "13.3 (17C45)", "available" : true, "platform" : "com.apple.platform.iphonesimulator", "modelCode" : "iPhone12,1", "identifier" : "3355075F-790F-4637-85B0-7DAD1F822BBF", "architecture" : "x86_64", "modelName" : "iPhone 11", "name" : "iPhone 11" } ] [ +49 ms] Error: user’s iPhone is not connected. Xcode will continue when user’s iPhone is connected. (code -13) [ +3 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update. [ ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update. [ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update. [ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update. [ +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update. [ +73 ms] Found plugin cloud_firestore at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.13.0+1/ [ +7 ms] Found plugin cloud_functions at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_functions-0.4.1+9/ [ +4 ms] Found plugin cloud_functions_web at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_functions_web-1.0.3/ [ +13 ms] Found plugin firebase_auth at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.15.4/ [ +4 ms] Found plugin firebase_auth_web at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth_web-0.1.2/ [ +3 ms] Found plugin firebase_core at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.4.3+3/ [ +4 ms] Found plugin firebase_core_web at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_web-0.1.1+2/ [ +6 ms] Found plugin flutter_plugin_android_lifecycle at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-1.0.5/ [ +7 ms] Found plugin google_maps_flutter at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/google_maps_flutter-0.5.22/ [ +32 ms] Found plugin url_launcher at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.4.1/ [ +1 ms] Found plugin url_launcher_macos at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-0.0.1+2/ [ +2 ms] Found plugin url_launcher_web at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_web-0.1.1/ [ +32 ms] Found plugin cloud_firestore at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.13.0+1/ [ +1 ms] Found plugin cloud_functions at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_functions-0.4.1+9/ [ +2 ms] Found plugin cloud_functions_web at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_functions_web-1.0.3/ [ +4 ms] Found plugin firebase_auth at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.15.4/ [ +2 ms] Found plugin firebase_auth_web at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth_web-0.1.2/ [ +1 ms] Found plugin firebase_core at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.4.3+3/ [ +1 ms] Found plugin firebase_core_web at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_web-0.1.1+2/ [ +1 ms] Found plugin flutter_plugin_android_lifecycle at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-1.0.5/ [ +32 ms] Found plugin google_maps_flutter at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/google_maps_flutter-0.5.22/ [ +16 ms] Found plugin url_launcher at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.4.1/ [ ] Found plugin url_launcher_macos at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-0.0.1+2/ [ +1 ms] Found plugin url_launcher_web at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_web-0.1.1/ [ +48 ms] Generating /Users/user/Documents/MyProjects/MyApp/app/admin/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java [ +110 ms] Launching lib/main.dart on Chrome in debug mode... [ +43 ms] Updating assets [ +84 ms] Syncing files to device Chrome... [ +5 ms] Found plugin cloud_firestore at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.13.0+1/ [ ] Found plugin cloud_functions at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_functions-0.4.1+9/ [ ] Found plugin cloud_functions_web at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_functions_web-1.0.3/ [ +4 ms] Found plugin firebase_auth at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.15.4/ [ +1 ms] Found plugin firebase_auth_web at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth_web-0.1.2/ [ +1 ms] Found plugin firebase_core at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.4.3+3/ [ +1 ms] Found plugin firebase_core_web at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_web-0.1.1+2/ [ +1 ms] Found plugin flutter_plugin_android_lifecycle at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-1.0.5/ [ +1 ms] Found plugin google_maps_flutter at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/google_maps_flutter-0.5.22/ [ +10 ms] Found plugin url_launcher at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.4.1/ [ ] Found plugin url_launcher_macos at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-0.0.1+2/ [ +1 ms] Found plugin url_launcher_web at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_web-0.1.1/ [ +5 ms] Found plugin cloud_firestore at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.13.0+1/ [ ] Found plugin cloud_functions at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_functions-0.4.1+9/ [ ] Found plugin cloud_functions_web at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_functions_web-1.0.3/ [ +3 ms] Found plugin firebase_auth at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.15.4/ [ ] Found plugin firebase_auth_web at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth_web-0.1.2/ [ ] Found plugin firebase_core at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.4.3+3/ [ +36 ms] Found plugin firebase_core_web at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_web-0.1.1+2/ [ +2 ms] Found plugin flutter_plugin_android_lifecycle at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-1.0.5/ [ +2 ms] Found plugin google_maps_flutter at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/google_maps_flutter-0.5.22/ [ +8 ms] Found plugin url_launcher at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.4.1/ [ ] Found plugin url_launcher_macos at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-0.0.1+2/ [ ] Found plugin url_launcher_web at /Users/user/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_web-0.1.1/ [ +6 ms] Generating /Users/user/Documents/MyProjects/MyApp/app/admin/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java [ +35 ms] <- reset [ +8 ms] /Users/user/flutter/bin/cache/dart-sdk/bin/dart /Users/user/flutter/bin/cache/artifacts/engine/darwin-x64/frontend_server.dart.snapshot --sdk-root /Users/user/flutter/bin/cache/flutter_web_sdk/ --incremental --target=dartdevc --debugger-module-names -Ddart.developer.causal_async_stacks=true --output-dill /var/folders/3p/bhps_g7n5mz0j4xfn_bkbngh0000gn/T/flutter_tool.tnXa7s/app.dill --libraries-spec file:///Users/user/flutter/bin/cache/flutter_web_sdk/libraries.json --packages /Users/user/Documents/MyProjects/MyApp/app/admin/.packages -Ddart.vm.profile=false -Ddart.vm.product=false --bytecode-options=source-positions,local-var-info,debugger-stops,instance-field-initializers,keep-unreachable-code,avoid-closure-call-instructions --enable-asserts --track-widget-creation --filesystem-root /var/folders/3p/bhps_g7n5mz0j4xfn_bkbngh0000gn/T/flutter_tools.7S3A5V --filesystem-scheme org-dartlang-app --initialize-from-dill build/cache.dill --platform file:///Users/user/flutter/bin/cache/flutter_web_sdk/kernel/flutter_ddc_sdk.dill [ +9 ms] <- compile org-dartlang-app:///web_entrypoint.dart [+16049 ms] Syncing files to device Chrome... (completed in 16,184ms, longer than expected) [ +1 ms] Synced 24.3MB. [ ] <- accept [ +333 ms] [CHROME]: [ +1 ms] [CHROME]:DevTools listening on ws://127.0.0.1:51078/devtools/browser/c86145e3-e53c-4eff-b9a6-34c707aa39bb [+3551 ms] Debug service listening on ws://127.0.0.1:51129/rpz5I0l_esE= [ +527 ms] Debug service listening on ws://127.0.0.1:51129/rpz5I0l_esE= [ +1 ms] Warning: Flutter's support for web development is not stable yet and hasn't [ ] been thoroughly tested in production environments. [ ] For more information see https://flutter.dev/web [ ] 🔥 To hot restart changes while running, press "r". To hot restart (and refresh the browser), press "R". [ ] For a more detailed help message, press "h". To quit, press "q". [ +129 ms] 1 ```
VladyslavBondarenko commented 4 years ago

@agordeev can you modify this example in such way to reproduce your case? https://github.com/FirebaseExtended/flutterfire/blob/master/packages/cloud_firestore/cloud_firestore/example/lib/main.dart

I tried such code ``` import 'dart:async'; import 'package:flutter/material.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; Future main() async { WidgetsFlutterBinding.ensureInitialized(); final FirebaseApp app = await FirebaseApp.configure( name: 'test', options: const FirebaseOptions( googleAppID: '1:79601577497:ios:5f2bcc6ba8cecddd', gcmSenderID: '79601577497', apiKey: 'AIzaSyArgmRGfB5kiQT6CunAOmKRVKEsxKmy6YI-G72PVU', projectID: 'flutter-firestore', ), ); final Firestore firestore = Firestore(app: app); runApp(MaterialApp( title: 'Firestore Example', home: MyHomePage(firestore: firestore))); } class MessageList extends StatelessWidget { MessageList({this.firestore}); final Firestore firestore; @override Widget build(BuildContext context) { return StreamBuilder( stream: firestore .collection("messages") .orderBy("created_at", descending: true) .snapshots(), builder: (BuildContext context, AsyncSnapshot snapshot) { if (!snapshot.hasData) return const Text('Loading...'); final int messageCount = snapshot.data.documents.length; return ListView.builder( itemCount: messageCount, itemBuilder: (_, int index) { final DocumentSnapshot document = snapshot.data.documents[index]; final dynamic message = document['message']; return ListTile( trailing: IconButton( onPressed: () => document.reference.delete(), icon: Icon(Icons.delete), ), title: Text( message != null ? message.toString() : '', ), subtitle: Text('Message ${index + 1} of $messageCount'), ); }, ); }, ); } } class MyHomePage extends StatelessWidget { MyHomePage({this.firestore}); final Firestore firestore; CollectionReference get messages => firestore.collection('messages'); Future _addMessage() async { await messages.add({ 'message': 'Hello world!', 'created_at': FieldValue.serverTimestamp(), }); } Future _runTransaction() async { firestore.runTransaction((Transaction transaction) async { final allDocs = await firestore.collection("messages").getDocuments(); final toBeRetrieved = allDocs.documents.sublist(allDocs.documents.length ~/ 2); final toBeDeleted = allDocs.documents.sublist(0, allDocs.documents.length ~/ 2); await Future.forEach(toBeDeleted, (DocumentSnapshot snapshot) async { await transaction.delete(snapshot.reference); }); await Future.forEach(toBeRetrieved, (DocumentSnapshot snapshot) async { await transaction.update(snapshot.reference, { "message": "Updated from Transaction", "created_at": FieldValue.serverTimestamp() }); }); }); await Future.forEach(List.generate(2, (index) => index), (item) async { await firestore.runTransaction((Transaction transaction) async { await Future.forEach(List.generate(10, (index) => index), (item) async { await transaction.set(firestore.collection("messages").document(), { "message": "Created from Transaction $item", "created_at": FieldValue.serverTimestamp() }); }); }); }); } Future _runBatchWrite() async { final batchWrite = firestore.batch(); final querySnapshot = await firestore .collection("messages") .orderBy("created_at") .limit(12) .getDocuments(); querySnapshot.documents .sublist(0, querySnapshot.documents.length - 3) .forEach((DocumentSnapshot doc) { batchWrite.updateData(doc.reference, { "message": "Batched message", "created_at": FieldValue.serverTimestamp() }); }); batchWrite.setData(firestore.collection("messages").document(), { "message": "Batched message created", "created_at": FieldValue.serverTimestamp() }); batchWrite.delete( querySnapshot.documents[querySnapshot.documents.length - 2].reference); batchWrite.delete(querySnapshot.documents.last.reference); await batchWrite.commit(); } void test() async { print('1'); final collection = Firestore.instance.collection('messages'); print(collection); print('2'); } @override Widget build(BuildContext context) { test(); return Scaffold( appBar: AppBar( title: const Text('Firestore Example'), actions: [ FlatButton( onPressed: _runTransaction, child: Text("Run Transaction"), ), FlatButton( onPressed: _runBatchWrite, child: Text("Batch Write"), ) ], ), body: MessageList(firestore: firestore), floatingActionButton: FloatingActionButton( onPressed: _addMessage, tooltip: 'Increment', child: const Icon(Icons.add), ), ); } } ```
and it works as intended ``` 1 Instance of 'CollectionReference' 2 ```
agordeev commented 4 years ago

I'm closing now as it appears working. Most likely it was something with imports.

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.