text:
I met a problem when I use the IOS-Tagent, why It has the nonzero exit code

CodeSign /Users/oscar/Library/Developer/Xcode/DerivedData/WebDriverAgent-bvkkmdjlhmigtyawxsuhszbxwbbp/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest/Frameworks/YYCache.framework (in target 'WebDriverAgentRunner' from project 'WebDriverAgent')
    cd /Users/oscar/Documents/iOS-Tagent
    export CODESIGN_ALLOCATE=/Users/oscar/Downloads/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate

Signing Identity:     "Apple Development: 3uc56pm@hpmails.com (D8SL93HRAN)"
Provisioning Profile: "iOS Team Provisioning Profile: com.oscarreseturn.WebDriverAgentRunner.xctrunner"
                      (4763b835-4ff5-4dfc-bf4c-f0cc352e40aa)

    /usr/bin/codesign --force --sign FAED25B5D8B68EE8E3F686AD8ADBE1B786B8EAA6 --timestamp=none --preserve-metadata=identifier,entitlements,flags /Users/oscar/Library/Developer/Xcode/DerivedData/WebDriverAgent-bvkkmdjlhmigtyawxsuhszbxwbbp/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest/Frameworks/YYCache.framework

/Users/oscar/Library/Developer/Xcode/DerivedData/WebDriverAgent-bvkkmdjlhmigtyawxsuhszbxwbbp/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest/Frameworks/YYCache.framework: replacing existing signature
Warning: unable to build chain to self-signed root for signer "Apple Development: 3uc56pm@hpmails.com (D8SL93HRAN)"
/Users/oscar/Library/Developer/Xcode/DerivedData/WebDriverAgent-bvkkmdjlhmigtyawxsuhszbxwbbp/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest/Frameworks/YYCache.framework: errSecInternalComponent
Command CodeSign failed with a nonzero exit code

@OscarReturn
When opening an issue, please try to provide all or some of the information indicated in the template.

Issue Template
If you are looking for support, please check out our documentation
or consider asking a question on Stack Overflow:
- https://flutter.dev/
- https://api.flutter.dev/
- https://stackoverflow.com/questions/tagged/flutter?sort=frequent

If you have found a bug or if our documentation doesn't have an answer
to what you're looking for, then fill our the template below. Please read
our guide to filing a bug first: https://flutter.dev/docs/resources/bug-reports

Steps to Reproduce

Please tell us exactly how to reproduce the problem you are running into.

Please attach a small application (ideally just one main.dart file) that
reproduces the problem. You could use https://gist.github.com/ for this.

If the problem is with your application's rendering, then please attach
a screenshot and explain what the problem is.

1. ...
2. ...
3. ...

Please tell us which target platform(s) the problem occurs (Android / iOS / Web / macOS / Linux / Windows)
Which target OS version, for Web, browser, is the test system running?
Does the problem occur on emulator/simulator as well as on physical devices?

Target Platform:
Target OS version/browser:
Devices:

Run your application with `flutter run --verbose` and attach all the
log output below between the lines with the backticks. If there is an
exception, please see if the error message includes enough information
to explain how to solve the issue.

Run `flutter analyze` and attach any output of that command below.
If there are any analysis errors, try resolving them before filing this issue.

Finally, paste the output of running `flutter doctor -v` here.

Closing this issue, since no information has been provided.
Thank you.

authors: OscarReturn darshankawar


text:
[in_app_purchase] Restore Purchase IOS , applicationUsername return null

Hi
i am having a problem when restoring payments from ios, applicationUsername returns null,while restoring from android is working fine

Hi @nduc86686, please provide a complete minimal reproducible code sample as well as the output of flutter doctor -v.
Please also provide the version of in_app_purchase you're using.
Thank you

Here is my flutter doctor -v and the version I'm using is in_app_purchase: ^3.0.7

[✓] Flutter (Channel stable, 2.10.4, on macOS 12.3 21E230 darwin-x64, locale en-VN)
• Flutter version 2.10.4 at /Users/tuannguyen/flutter-2
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision c860cba910 (5 months ago), 2022-03-25 00:23:12 -0500
• Engine revision 57d3bac3dd
• Dart version 2.16.2
• DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at /Users/tuannguyen/Library/Android/sdk
• Platform android-33, build-tools 33.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.3

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] Connected device (3 available)
• Redmi 6A (mobile) • fb0e68af7d23              • android-arm    • Android 9 (API 28)
• iPhone (mobile)   • 00008020-00156D212229402E • ios            • iOS 15.6 19G71
• Chrome (web)      • chrome                    • web-javascript • Google Chrome 104.0.5112.79

[✓] HTTP Host Availability
• All required HTTP hosts are available

• No issues found!

Here is my code
  void restore() async{     var username=await _authRepository.getUserId();     await InAppPurchaseModule.getInstance().inAppPurchase.restorePurchases(applicationUserName:'$username' );   }

Hi @nduc86686, do you pass in the applicationUsername when you are creating the purchase object the first time around?

yes, when I made my first purchase, I passed the parameter applicationUserName.After making the purchase, the PurchaseDetails still return applicationUserName. But when I do the Restore, the applicationUserName is null as described above.
    if (Platform.isAndroid) {
      final purchasess =
          Map<String, PurchaseDetails>.fromEntries(
              _purchases.map((PurchaseDetails purchase) {
        if (purchase.pendingCompletePurchase) {
          _inAppPurchase.completePurchase(purchase);
        }
        return MapEntry<String, PurchaseDetails>(purchase.productID, purchase);
      }));
      final oldSubscription = _getOldSubscription(productDetails, purchasess);
      purchaseParam = GooglePlayPurchaseParam(
          productDetails: productDetails,
          applicationUserName: applicationUserName,
          changeSubscriptionParam: (oldSubscription != null)
              ? ChangeSubscriptionParam(
                  oldPurchaseDetails: oldSubscription,
                  prorationMode: ProrationMode.immediateWithTimeProration)
              : null);
    } else {
      purchaseParam = PurchaseParam(
        productDetails: productDetails,
        applicationUserName: applicationUserName ?? '',
      );
    }

Hi @nduc86686, kindly share the full code sample you use to handle the IAP.
Thank you

Below is my code.thank you!

import 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:in_app_purchase/in_app_purchase.dart';
import 'package:in_app_purchase_android/billing_client_wrappers.dart';
import 'package:in_app_purchase_android/in_app_purchase_android.dart';
import 'package:in_app_purchase_storekit/in_app_purchase_storekit.dart';
import 'package:in_app_purchase_storekit/store_kit_wrappers.dart';
import 'consumable_store.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();

  runApp(_MyApp());
}

// Auto-consume must be true on iOS.
// To try without auto-consume on another platform, change `true` to `false` here.
final bool _kAutoConsume = Platform.isIOS || true;

const String _kConsumableId = 'consumable';
const String _kUpgradeId = 'upgrade';
const String _kSilverSubscriptionId = 'subscription_silver';
const String _kGoldSubscriptionId = 'subscription_gold';
const List<String> _kProductIds = <String>[
  _kConsumableId,
  _kUpgradeId,
  _kSilverSubscriptionId,
  _kGoldSubscriptionId,
];

class _MyApp extends StatefulWidget {
  @override
  State<_MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<_MyApp> {
  final InAppPurchase _inAppPurchase = InAppPurchase.instance;
  late StreamSubscription<List<PurchaseDetails>> _subscription;
  List<String> _notFoundIds = <String>[];
  List<ProductDetails> _products = <ProductDetails>[];
  List<PurchaseDetails> _purchases = <PurchaseDetails>[];
  List<String> _consumables = <String>[];
  bool _isAvailable = false;
  bool _purchasePending = false;
  bool _loading = true;
  String? _queryProductError;

  @override
  void initState() {
    final Stream<List<PurchaseDetails>> purchaseUpdated =
        _inAppPurchase.purchaseStream;
    _subscription =
        purchaseUpdated.listen((List<PurchaseDetails> purchaseDetailsList) {
          _listenToPurchaseUpdated(purchaseDetailsList);
        }, onDone: () {
          _subscription.cancel();
        }, onError: (Object error) {
          // handle error here.
        });
    initStoreInfo();
    super.initState();
  }

  Future<void> initStoreInfo() async {
    final bool isAvailable = await _inAppPurchase.isAvailable();
    if (!isAvailable) {
      setState(() {
        _isAvailable = isAvailable;
        _products = <ProductDetails>[];
        _purchases = <PurchaseDetails>[];
        _notFoundIds = <String>[];
        _consumables = <String>[];
        _purchasePending = false;
        _loading = false;
      });
      return;
    }

    if (Platform.isIOS) {
      final InAppPurchaseStoreKitPlatformAddition iosPlatformAddition =
      _inAppPurchase
          .getPlatformAddition<InAppPurchaseStoreKitPlatformAddition>();
      await iosPlatformAddition.setDelegate(ExamplePaymentQueueDelegate());
    }

    final ProductDetailsResponse productDetailResponse =
    await _inAppPurchase.queryProductDetails(_kProductIds.toSet());
    if (productDetailResponse.error != null) {
      setState(() {
        _queryProductError = productDetailResponse.error!.message;
        _isAvailable = isAvailable;
        _products = productDetailResponse.productDetails;
        _purchases = <PurchaseDetails>[];
        _notFoundIds = productDetailResponse.notFoundIDs;
        _consumables = <String>[];
        _purchasePending = false;
        _loading = false;
      });
      return;
    }

    if (productDetailResponse.productDetails.isEmpty) {
      setState(() {
        _queryProductError = null;
        _isAvailable = isAvailable;
        _products = productDetailResponse.productDetails;
        _purchases = <PurchaseDetails>[];
        _notFoundIds = productDetailResponse.notFoundIDs;
        _consumables = <String>[];
        _purchasePending = false;
        _loading = false;
      });
      return;
    }

    final List<String> consumables = await ConsumableStore.load();
    setState(() {
      _isAvailable = isAvailable;
      _products = productDetailResponse.productDetails;
      _notFoundIds = productDetailResponse.notFoundIDs;
      _consumables = consumables;
      _purchasePending = false;
      _loading = false;
    });
  }

  @override
  void dispose() {
    if (Platform.isIOS) {
      final InAppPurchaseStoreKitPlatformAddition iosPlatformAddition =
      _inAppPurchase
          .getPlatformAddition<InAppPurchaseStoreKitPlatformAddition>();
      iosPlatformAddition.setDelegate(null);
    }
    _subscription.cancel();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    final List<Widget> stack = <Widget>[];
    if (_queryProductError == null) {
      stack.add(
        ListView(
          children: <Widget>[
            _buildConnectionCheckTile(),
            _buildProductList(),
            _buildConsumableBox(),
            _buildRestoreButton(),
          ],
        ),
      );
    } else {
      stack.add(Center(
        child: Text(_queryProductError!),
      ));
    }
    if (_purchasePending) {
      stack.add(
        Stack(
          children: const <Widget>[
            Opacity(
              opacity: 0.3,
              child: ModalBarrier(dismissible: false, color: Colors.grey),
            ),
            Center(
              child: CircularProgressIndicator(),
            ),
          ],
        ),
      );
    }

    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('IAP Example'),
        ),
        body: Stack(
          children: stack,
        ),
      ),
    );
  }

  Card _buildConnectionCheckTile() {
    if (_loading) {
      return const Card(child: ListTile(title: Text('Trying to connect...')));
    }
    final Widget storeHeader = ListTile(
      leading: Icon(_isAvailable ? Icons.check : Icons.block,
          color: _isAvailable ? Colors.green : ThemeData.light().errorColor),
      title:
      Text('The store is ${_isAvailable ? 'available' : 'unavailable'}.'),
    );
    final List<Widget> children = <Widget>[storeHeader];

    if (!_isAvailable) {
      children.addAll(<Widget>[
        const Divider(),
        ListTile(
          title: Text('Not connected',
              style: TextStyle(color: ThemeData.light().errorColor)),
          subtitle: const Text(
              'Unable to connect to the payments processor. Has this app been configured correctly? See the example README for instructions.'),
        ),
      ]);
    }
    return Card(child: Column(children: children));
  }

  Card _buildProductList() {
    if (_loading) {
      return const Card(
          child: ListTile(
              leading: CircularProgressIndicator(),
              title: Text('Fetching products...')));
    }
    if (!_isAvailable) {
      return const Card();
    }
    const ListTile productHeader = ListTile(title: Text('Products for Sale'));
    final List<ListTile> productList = <ListTile>[];
    if (_notFoundIds.isNotEmpty) {
      productList.add(ListTile(
          title: Text('[${_notFoundIds.join(", ")}] not found',
              style: TextStyle(color: ThemeData.light().errorColor)),
          subtitle: const Text(
              'This app needs special configuration to run. Please see example/README.md for instructions.')));
    }

    // This loading previous purchases code is just a demo. Please do not use this as it is.
    // In your app you should always verify the purchase data using the `verificationData` inside the [PurchaseDetails] object before trusting it.
    // We recommend that you use your own server to verify the purchase data.
    final Map<String, PurchaseDetails> purchases =
    Map<String, PurchaseDetails>.fromEntries(
        _purchases.map((PurchaseDetails purchase) {
          if (purchase.pendingCompletePurchase) {
            _inAppPurchase.completePurchase(purchase);
          }
          return MapEntry<String, PurchaseDetails>(purchase.productID, purchase);
        }));
    productList.addAll(_products.map(
          (ProductDetails productDetails) {
        final PurchaseDetails? previousPurchase = purchases[productDetails.id];
        return ListTile(
          title: Text(
            productDetails.title,
          ),
          subtitle: Text(
            productDetails.description,
          ),
          trailing: previousPurchase != null
              ? IconButton(
              onPressed: () => confirmPriceChange(context),
              icon: const Icon(Icons.upgrade))
              : TextButton(
            style: TextButton.styleFrom(
              backgroundColor: Colors.green[800],
              // TODO(darrenaustin): Migrate to new API once it lands in stable: https://github.com/flutter/flutter/issues/105724
              // ignore: deprecated_member_use
              primary: Colors.white,
            ),
            onPressed: () {
              late PurchaseParam purchaseParam;

              if (Platform.isAndroid) {
                // NOTE: If you are making a subscription purchase/upgrade/downgrade, we recommend you to
                // verify the latest status of you your subscription by using server side receipt validation
                // and update the UI accordingly. The subscription purchase status shown
                // inside the app may not be accurate.
                final GooglePlayPurchaseDetails? oldSubscription =
                _getOldSubscription(productDetails, purchases);

                purchaseParam = GooglePlayPurchaseParam(
                    productDetails: productDetails,
                    changeSubscriptionParam: (oldSubscription != null)
                        ? ChangeSubscriptionParam(
                      oldPurchaseDetails: oldSubscription,
                      prorationMode:
                      ProrationMode.immediateWithTimeProration,
                    )
                        : null);
              } else {
                purchaseParam = PurchaseParam(
                  productDetails: productDetails,
                  ///exemple:'123456789'
                  applicationUserName: '123456789'
                );
              }

              if (productDetails.id == _kConsumableId) {
                _inAppPurchase.buyConsumable(
                    purchaseParam: purchaseParam,
                    autoConsume: _kAutoConsume);
              } else {
                _inAppPurchase.buyNonConsumable(
                    purchaseParam: purchaseParam,
                );
              }
            },
            child: Text(productDetails.price),
          ),
        );
      },
    ));

    return Card(
        child: Column(
            children: <Widget>[productHeader, const Divider()] + productList));
  }

  Card _buildConsumableBox() {
    if (_loading) {
      return const Card(
          child: ListTile(
              leading: CircularProgressIndicator(),
              title: Text('Fetching consumables...')));
    }
    if (!_isAvailable || _notFoundIds.contains(_kConsumableId)) {
      return const Card();
    }
    const ListTile consumableHeader =
    ListTile(title: Text('Purchased consumables'));
    final List<Widget> tokens = _consumables.map((String id) {
      return GridTile(
        child: IconButton(
          icon: const Icon(
            Icons.stars,
            size: 42.0,
            color: Colors.orange,
          ),
          splashColor: Colors.yellowAccent,
          onPressed: () => consume(id),
        ),
      );
    }).toList();
    return Card(
        child: Column(children: <Widget>[
          consumableHeader,
          const Divider(),
          GridView.count(
            crossAxisCount: 5,
            shrinkWrap: true,
            padding: const EdgeInsets.all(16.0),
            children: tokens,
          )
        ]));
  }

  Widget _buildRestoreButton() {
    if (_loading) {
      return Container();
    }

    return Padding(
      padding: const EdgeInsets.all(4.0),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.end,
        children: <Widget>[
          TextButton(
            style: TextButton.styleFrom(
              backgroundColor: Theme.of(context).primaryColor,
              // TODO(darrenaustin): Migrate to new API once it lands in stable: https://github.com/flutter/flutter/issues/105724
              // ignore: deprecated_member_use
              primary: Colors.white,
            ),
            onPressed: () => _inAppPurchase.restorePurchases(applicationUserName: '123456789'),
            child: const Text('Restore purchases'),
          ),
        ],
      ),
    );
  }

  Future<void> consume(String id) async {
    await ConsumableStore.consume(id);
    final List<String> consumables = await ConsumableStore.load();
    setState(() {
      _consumables = consumables;
    });
  }

  void showPendingUI() {
    setState(() {
      _purchasePending = true;
    });
  }

  Future<void> deliverProduct(PurchaseDetails purchaseDetails) async {
    // IMPORTANT!! Always verify purchase details before delivering the product.
    if (purchaseDetails.productID == _kConsumableId) {
      await ConsumableStore.save(purchaseDetails.purchaseID!);
      final List<String> consumables = await ConsumableStore.load();
      setState(() {
        _purchasePending = false;
        _consumables = consumables;
      });
    } else {
      setState(() {
        _purchases.add(purchaseDetails);
        _purchasePending = false;
      });
    }
  }

  void handleError(IAPError error) {
    setState(() {
      _purchasePending = false;
    });
  }

  Future<bool> _verifyPurchase(PurchaseDetails purchaseDetails) {
    // IMPORTANT!! Always verify a purchase before delivering the product.
    // For the purpose of an example, we directly return true.
    return Future<bool>.value(true);
  }

  void _handleInvalidPurchase(PurchaseDetails purchaseDetails) {
    // handle invalid purchase here if  _verifyPurchase` failed.
  }

  Future<void> _listenToPurchaseUpdated(
      List<PurchaseDetails> purchaseDetailsList) async {
    for (final PurchaseDetails purchaseDetails in purchaseDetailsList) {
      if (purchaseDetails.status == PurchaseStatus.pending) {
        showPendingUI();
      } else {
        if (purchaseDetails.status == PurchaseStatus.error) {
          handleError(purchaseDetails.error!);
        } else if (purchaseDetails.status == PurchaseStatus.purchased ||
            purchaseDetails.status == PurchaseStatus.restored) {
          final bool valid = await _verifyPurchase(purchaseDetails);
          if (valid) {
            deliverProduct(purchaseDetails);
          } else {
            _handleInvalidPurchase(purchaseDetails);
            return;
          }
        }
        if (Platform.isAndroid) {
          if (!_kAutoConsume && purchaseDetails.productID == _kConsumableId) {
            final InAppPurchaseAndroidPlatformAddition androidAddition =
            _inAppPurchase.getPlatformAddition<
                InAppPurchaseAndroidPlatformAddition>();
            await androidAddition.consumePurchase(purchaseDetails);
          }
        }
        if (purchaseDetails.pendingCompletePurchase) {
          await _inAppPurchase.completePurchase(purchaseDetails);
        }
      }
    }
  }

  Future<void> confirmPriceChange(BuildContext context) async {
    if (Platform.isAndroid) {
      final InAppPurchaseAndroidPlatformAddition androidAddition =
      _inAppPurchase
          .getPlatformAddition<InAppPurchaseAndroidPlatformAddition>();
      final BillingResultWrapper priceChangeConfirmationResult =
      await androidAddition.launchPriceChangeConfirmationFlow(
        sku: 'purchaseId',
      );
      if (priceChangeConfirmationResult.responseCode == BillingResponse.ok) {
        ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
          content: Text('Price change accepted'),
        ));
      } else {
        ScaffoldMessenger.of(context).showSnackBar(SnackBar(
          content: Text(
            priceChangeConfirmationResult.debugMessage ??
                'Price change failed with code ${priceChangeConfirmationResult.responseCode}',
          ),
        ));
      }
    }
    if (Platform.isIOS) {
      final InAppPurchaseStoreKitPlatformAddition iapStoreKitPlatformAddition =
      _inAppPurchase
          .getPlatformAddition<InAppPurchaseStoreKitPlatformAddition>();
      await iapStoreKitPlatformAddition.showPriceConsentIfNeeded();
    }
  }

  GooglePlayPurchaseDetails? _getOldSubscription(
      ProductDetails productDetails, Map<String, PurchaseDetails> purchases) {
    // This is just to demonstrate a subscription upgrade or downgrade.
    // This method assumes that you have only 2 subscriptions under a group, 'subscription_silver' & 'subscription_gold'.
    // The 'subscription_silver' subscription can be upgraded to 'subscription_gold' and
    // the 'subscription_gold' subscription can be downgraded to 'subscription_silver'.
    // Please remember to replace the logic of finding the old subscription Id as per your app.
    // The old subscription is only required on Android since Apple handles this internally
    // by using the subscription group feature in iTunesConnect.
    GooglePlayPurchaseDetails? oldSubscription;
    if (productDetails.id == _kSilverSubscriptionId &&
        purchases[_kGoldSubscriptionId] != null) {
      oldSubscription =
      purchases[_kGoldSubscriptionId]! as GooglePlayPurchaseDetails;
    } else if (productDetails.id == _kGoldSubscriptionId &&
        purchases[_kSilverSubscriptionId] != null) {
      oldSubscription =
      purchases[_kSilverSubscriptionId]! as GooglePlayPurchaseDetails;
    }
    return oldSubscription;
  }
}

/// Example implementation of the
/// [`SKPaymentQueueDelegate`](https://developer.apple.com/documentation/storekit/skpaymentqueuedelegate?language=objc).
///
/// The payment queue delegate can be implementated to provide information
/// needed to complete transactions.
class ExamplePaymentQueueDelegate implements SKPaymentQueueDelegateWrapper {
  @override
  bool shouldContinueTransaction(
      SKPaymentTransactionWrapper transaction, SKStorefrontWrapper storefront) {
    return true;
  }

  @override
  bool shouldShowPriceConsent() {
    return false;
  }
}

I can reproduce something similar to https://github.com/flutter/flutter/issues/109672#issuecomment-1221733792.
I made a purchase and waited for a few minutes before calling restorePurchases. I have multiple items in the logs because I was deleting the app to simulate a fresh install and then I would either restore or purchase the items again. In most cases, the PurchaseDetails contained the applicationUsername when the transaction was completed, but when I called restorePurchases, the applicationUsername was null.
The code sample from plugin example should be enough to reproduce this issue.
Labeling for further investigation from the team.

logs
Launching lib/main.dart on Nexus in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: X8NNQ9CYL2
Xcode build done.                                           21.0s
(lldb) 2022-08-23 10:40:05.972059+0000 Runner[51961:7363448] Warning: Unable to create restoration in progress marker file
Connecting to VM Service at ws://127.0.0.1:58212/bjOX6QQvr94=/ws
fopen failed for data file: errno = 2 (No such file or directory)
Errors found! Invalidating cache...
fopen failed for data file: errno = 2 (No such file or directory)
Errors found! Invalidating cache...
Successfully load keyboard extensions
flutter: {productIdentifier: com.nevercode.triage.silver_subscription, applicationUsername: 0a95dc25-c6e3-4050-b9e0-58f52a53253c, requestData: null, quantity: 1, simulatesAskToBuyInSandbox: false}
flutter: {productIdentifier: com.nevercode.triage.silver_subscription, applicationUsername: null, requestData: null, quantity: 1, simulatesAskToBuyInSandbox: false}
flutter: {productIdentifier: com.nevercode.triage.silver_subscription, applicationUsername: null, requestData: null, quantity: 1, simulatesAskToBuyInSandbox: false}
flutter: {productIdentifier: com.nevercode.triage.gold_subscription, applicationUsername: null, requestData: null, quantity: 1, simulatesAskToBuyInSandbox: false}
flutter: {productIdentifier: com.nevercode.triage.gold_subscription, applicationUsername: null, requestData: null, quantity: 1, simulatesAskToBuyInSandbox: false}
flutter: {productIdentifier: com.nevercode.triage.silver_subscription, applicationUsername: null, requestData: null, quantity: 1, simulatesAskToBuyInSandbox: false}
flutter: {productIdentifier: com.nevercode.triage.silver_subscription, applicationUsername: null, requestData: null, quantity: 1, simulatesAskToBuyInSandbox: false}

flutter doctor -v
[✓] Flutter (Channel stable, 3.0.5, on macOS 12.5 21G72 darwin-arm, locale en-GB)
    • Flutter version 3.0.5 at /Users/nexus/dev/sdks/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f1875d570e (6 weeks ago), 2022-07-13 11:24:16 -0700
    • Engine revision e85ea0e79c
    • Dart version 2.17.6
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] VS Code (version 1.70.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.46.0

[✓] Connected device (4 available)
    • Nexus (mobile)             • 00008020-001875E83A38002E            • ios            • iOS 15.6 19G71
    • iPhone 13 Pro Max (mobile) • FD5949EA-E739-4960-9E9D-16F3DE69816E • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-5 (simulator)
    • macOS (desktop)            • macos                                • darwin-arm64   • macOS 12.5 21G72 darwin-arm
    • Chrome (web)               • chrome                               • web-javascript • Google Chrome 104.0.5112.101

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

[✓] Flutter (Channel master, 3.1.0-0.0.pre.2428, on macOS 12.5 21G72 darwin-arm, locale en-GB)
    • Flutter version 3.1.0-0.0.pre.2428 on channel master at /Users/nexus/dev/sdks/flutters
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 328545e5af (8 hours ago), 2022-08-22 22:31:06 -0400
    • Engine revision ca48808d06
    • Dart version 2.19.0 (build 2.19.0-124.0.dev)
    • DevTools version 2.16.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 13F100
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] VS Code (version 1.70.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.46.0

[✓] Connected device (4 available)
    • Nexus (mobile)             • 00008020-001875E83A38002E            • ios            • iOS 15.6 19G71
    • iPhone 13 Pro Max (mobile) • FD5949EA-E739-4960-9E9D-16F3DE69816E • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-5 (simulator)
    • macOS (desktop)            • macos                                • darwin-arm64   • macOS 12.5 21G72 darwin-arm
    • Chrome (web)               • chrome                               • web-javascript • Google Chrome 104.0.5112.101

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

As per: https://developer.apple.com/documentation/storekit/skmutablepayment/1506088-applicationusername?language=objc
"An applicationUsername property that isn’t a UUID isn’t guaranteed to persist between the time when you add the payment transaction to the queue and when the queue updates the transaction."
This looks like a new thing and we need to document it well.

This seems a new restriction from StoreKit and we should add this information to our documentation.

yes, I used the user UUID on my private server.
I have carefully tested using the ios payment history list api, and it still returns the uuid I have associated the transaction with the user

json return
{ "id": 232, "userId": "bb8576ac-f00e-4e5f-bfd9-a36f4e435244f", "paymentPackage": "test", "store": "appleStore", "orderId": "2000000136534049", "json": { "status": 1, "signedRenewalInfo": { "productId": "test.exemple.purchase.01", "signedDate": 1661252224579, "environment": "Sandbox", "autoRenewStatus": 1, "autoRenewProductId": "test.exemple.purchase.01", "originalTransactionId": "2000000136101589", "recentSubscriptionStartDate": 1661230339000 }, "originalTransactionId": "2000000136101589", "signedTransactionInfo": { "type": "Auto-Renewable Subscription", "bundleId": "xxx-xxx-xxx", "quantity": 1, "productId": "test.exemple.purchase.01", "signedDate": 1661252224579, "environment": "Sandbox", "expiresDate": 1661253806000, "purchaseDate": 1661252006000, "transactionId": "2000000136534049", "appAccountToken": "87ab1d60-0ef8-40e6-9ede-e8ace3ff9360", "inAppOwnershipType": "PURCHASED", "webOrderLineItemId": "2000000009682403", "originalPurchaseDate": 1661230345000, "originalTransactionId": "2000000136101589", "subscriptionGroupIdentifier": "21006854" } }, "createdAt": "2022-08-23T10:57:04.839Z", "updatedAt": "2022-08-23T10:57:04.839Z" },

same issue here

source: gharchive/issue

authors: can-cc cyanglaz danagbemava-nc nduc86686

repo: flutter/flutter

license_type: permissive

license_source: github-api


text:
Add color property to CupertinoScrollbar

Hello,
The CupertinoActivityIndicator widget has a color property, which is used internally like widget.color ?? CupertinoDynamicColor.resolve(_kActiveTickColor, context),
But the CupertinoScrollbar widget has its color ~hardcoded(unchangeable by user), used by widget like CupertinoDynamicColor.resolve(_kScrollbarColor, context),
Currently i have copied the widget from the flutter library sources, and added the color property manually and locally, but would be better if implemented and supported officially,
thanking you

Hello @gintominto5329. Thank you for filing this proposal. This looks like a duplicate of https://github.com/flutter/flutter/issues/99013. Please follow up on that issue. Closing this one for the same reason. Thank you


text:
minCompileSdk is 32 not 19 or 20,version webview_flutter: ^3.0.4

The minCompileSdk (32) specified in a
[2022-12-01 20:56:18]     dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
[2022-12-01 20:56:18]     is greater than this module's compileSdkVersion (android-31).
[2022-12-01 20:56:18]     Dependency: androidx.webkit:webkit:1.5.0.
[2022-12-01 20:56:18]     AAR metadata file: /root/.gradle/caches/transforms-3/2ddf6621a12dce3906273733bc5a665a/transformed/webkit-1.5.0/META-INF/com/android/build/gradle/aar-metadata.properties.

Hello @zhangzheng567. Thank you for filing this issue. Can you please provide the following information?

A complete and minimal, reproducible example. Ideally, a single main.dart file that can be run directly.
The output of flutter doctor -v
The output of flutter run -v

Please provide the information in the form of text. See how to make collapsible sections with Markdown here.

Changing the compileSdkVersion in your android/app/build.gradle to 32 should fix this issue. Since this is not an issue with Flutter, I am closing it. If you disagree, please comment with your reasoning and I can reopen the issue.
PS: Thanks @RaphAlemoh for the help here :)


text:
Migration to Gradle 7.3+, for compatibility with the JDK 17 in Android Studio Flamingo

Gradle (the build system used for Android apps) has an awkwardly strict dependency on the version of Java it runs on: if you try to run a moderately old Gradle on a new JDK, the build will fail. Moreover it will do so with a totally inscrutable error.
This is about to become a problem for lots of Flutter developers, because the Gradle version that flutter create would set up until recently is incompatible with the JDK version that lots of developers are going to be upgraded to in a couple of months. Many of them will not realize their JDK was upgraded. Because the Gradle error message is so bad, they will have a frustrating day of debugging, of StackOverflow questions, and likely of taking part in a flood of reports and comments in the Flutter issue tracker.
I think the only feasible way to avoid that flood of frustration is probably to write a migration (like these and these) to upgrade existing projects from the Gradle versions flutter create  would have chosen in the past to the version flutter create would choose today.
Problem details
The exact Gradle version to use is encoded in a project's tree, at android/gradle/wrapper/gradle-wrapper.properties.
Up until #99723, less than a year ago, the default from flutter create was Gradle 6.7. So any project created before then is using that version or older, unless it's had an upgrade to the Gradle version.
Starting with Android Studio 2022.2 "Flamingo", the JDK bundled with Android Studio will switch from JDK 11 to JDK 17. That Android Studio version is currently in beta. It will presumably become the new stable in approximately May — at which point developers running existing Android Studio stable versions will start getting prompts to upgrade to it, and large numbers of them will do so.
(Compare the sudden flood of comments on #106674, the last major issue triggered by an Android Studio upgrade, starting on Jan 12. That was the release date of 2022.1 "Electric Eel" to stable.)
Whatever JDK comes bundled with Android Studio becomes the JDK that the flutter tool uses by default. In doing so, the tool is faithfully following the recommendation from Android upstream. Many developers, following that same advice, will not even have any other JDK installation lying around.
And Gradle 6.7 is incompatible with JDK 17. So is any other version before Gradle 7.3. If you try to run an older Gradle with that newer JDK, you get an error like this:
FAILURE: Build failed with an exception.

* Where:
Build file '…/example/android/build.gradle'

* What went wrong:
Could not compile build file '…/example/android/build.gradle'.
> startup failed:
  General error during conversion: Unsupported class file major version 61

  java.lang.IllegalArgumentException: Unsupported class file major version 61
  	at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:189)
  	at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:170)
  	[…
  	 …
  	 … 209 more lines of Groovy and Gradle stack trace …
  	 …
  	 …]
  	at java.base/java.lang.Thread.run(Thread.java:833)

Putting it together: anyone who created a project with flutter create from a Flutter older than last May's Flutter 3.0, and hasn't manually upgraded the version of Gradle it uses, will get the inscrutable error above the next time they attempt flutter run or flutter build for Android after they acquiesce to Android Studio's next round of self-upgrade prompts in a couple of months.
Alternate solutions
There are a couple of things we could do to help people choose a JDK independent of their upgrading Android Studio:

#121501
#106416

I think we ideally should do those things, on their own merits, but I don't think they really solve this problem. At best, they can only help when the developer knows that what they need is to use another JDK. Because that Gradle error message is so bad, and because the JDK upgrade will have happened as a side effect of upgrading Android Studio, that's already not easy to figure out.
Workarounds
The existing workarounds I know of are:

Upgrade Gradle in your project. This is by far the preferred option. Once you've reached the point that you know this is what you need, and once you've worked out the steps involved in an upgrade, it's generally a pretty small and painless change.
Don't upgrade Android Studio past 2022.1 "Electric Eel".
Keep an Android Studio "Electric Eel" installation (or older) lying around, even while using a newer version. Then use flutter config --android-studio-dir=… to tell Flutter to look at that Android Studio installation, instead of the newer one, when looking for a JDK.

Why isn't this a problem for Android in general?
If you open an Android project in Android Studio, you get regularly prompted to upgrade Gradle and the Android Gradle Plugin, any time your project isn't already using the latest stable versions. Android Studio provides a slick UI for doing so, too. So anyone working directly in Android will have had ample notice and opportunity to take this upgrade already.
If you open a Flutter project in Android Studio, however, there's no such prompt, even when the project has an android/ folder with an Android build. It's only if you open that android/ folder as its own project that you get Android-specific prompts, including those for the Gradle upgrade. If you're happily writing pure Dart code, and not regularly digging into the Android platform side, you may never have cause to see them.
Other related issues

Most of the example apps in flutter/packages need this upgrade: #122213
(So do apps in dev/integration_tests/ in flutter/flutter, and apps in the flutter/platform_tests repo.)

Steps to Reproduce
See the repro steps in #121501. For this issue, only steps 1-4 are needed.
For step 3, instead of going to an existing Flutter project that's using an older Gradle version, one can make the point sharper (for this issue) by running flutter create using Flutter 2.10.5 or older. See https://github.com/flutter/flutter/issues/121501#issuecomment-1447718241 .

I just want to comment on a few things here

I am using the latest Android Studio Canary, Flutter version 3.7.7, and my gradle versions are up to date
I still get Unsupported class file major version errors very frequently (probably caused bypubspec.yaml changes), and the only way I've found to fix it is to open Android Studio and click the gradle sync button. The flutter tool should probably be doing whatever that button does automatically.
I still get Unable to find bundled Java version. when running flutter doctor (kind of unrelated but you did mention that issue)
Opening the android/build.gradle file in Android Stuido is the only correct way to open a Flutter project in Android Studio if you're dealing with native Android code

I still get Unsupported class file major version errors very frequently (probably caused bypubspec.yaml changes), and the only way I've found to fix it is to open Android Studio and click the gradle sync button. The flutter tool should probably be doing whatever that button does automatically.

Interesting. If you're seeing that when you have a current Gradle version, that would be good to file as a new issue so it can be investigated.

I still get Unable to find bundled Java version. when running flutter doctor (kind of unrelated but you did mention that issue)

This would also be good to report as its own issue. Though take a look first at existing open issues:
https://github.com/flutter/flutter/issues?q=is%3Aopen+label%3Atool+label%3Aplatform-android+unable+to+find+bundled+jdk
to see if one of them covers it.

Opening the android/build.gradle file in Android Stuido is the only correct way to open a Flutter project in Android Studio if you're dealing with native Android code

If you're dealing with native Android code, then yes, you're going to want to open the android/ subfolder as its own project in Android Studio. (Though not necessarily the android/build.gradle file in particular, if you're just doing work in other files.) When you do, you'll see Android Studio's prompts to upgrade Gradle.
As I said in the OP, though, if you're happily writing pure Dart code, and not regularly digging into the Android platform side, then you may never have cause to see those prompts, precisely because you're not opening the android/ subfolder as its own project. And I think "happily writing pure Dart code" is the state most Flutter developers, most of the time, want to be in and a state our tools aim to support.

@reidbaker WDYT about the priority for this?

@christopherfujino extremely high priority. I am dropping my other work to dig into this. I expect Flamingo to be stable in mid april prior to Google io.

Might be related, I tried to regenerate all the gradle lockfiles from our test apps, and I ran into CI failures in https://github.com/flutter/flutter/pull/119290/files

Update from today's coding session and a conversation with the tools team.
I have some code that gets the gradle version, We already have code that attempts to find the java jdk but it does not parse the version.
I also found code that parses the AGP version. We also have code that attempts to match gradle and AGP
Unfortunately flutter doctor is the wrong context to expose this information since is focused on machine global setup not per project. Apparently flutter analyze --suggestions was intended to be "flutter doctor but for projects".
I do not think this is discoverable enough to protect our users from a confusing error message but after talking to the tools team this is a safe and reasonable place to land code to detect the situation we are worried about. Then we can use/share this code in other parts of the tooling.
Finally I plan to create a google doc that covers the entire problem of "android studio, java sdk, AGP, Gradle versions and all the ways we are going to try to mitigate the pain for flutter devs including comms" When I do I will post a link here.

Here is my overarching doc covering this problem since I think it is likely we will have a few bugs to fix and some features to build to mitigate this. https://docs.google.com/document/d/1hTXkjbUrBnXgu8NQsth1c3aEqo77rWoEj8CcsQ39wwQ/edit#

I am going to try to update this at least 3x a week until I am comfortable with the state.
I have code that gets AGP versions from build.gradle and tests for a new function that validates agp and gradle.  Along with improving the documentation from the code written yesterday.
Next steps are to figure out how the tools team wants me to incorporate the version of java into project.dart.
Given https://github.com/flutter/flutter/issues/122609#issuecomment-1474293403 I am tempted to write new code that gets the java version and attempts to parse gradle.properties since that will be how gradle decides then mirror the java version code searching done in flutter doctor.

Update: responded to doc feedback.
Currently stuck on the design for what code should get the java version.
We have some code that already finds java in android_sdk.dart
My question (most likely from tools contributors), What is the right way to run code from android_sdk.dart in project.dart?
My reading shows them as different use-cases (maybe also lifecycles)
Should I
A) Have code in project.dart that gets the java version number independent of the code that finds the java binary?
B) Extract android_sdk code into a static helper and try to give the dependencies from both android_sdk and project.dart
C) Yall tell me some way those classes are already related and I can use an instance of android_sdk in project.dart (and maybe i feel a bit dumb)
D) something else
Right now I am leaning towards writing new code to find the java version and then dealing with the duplication in code review.

My question (most likely from tools contributors), What is the right way to run code from android_sdk.dart in project.dart?
My reading shows them as different use-cases (maybe also lifecycles)

I don't own this code, but FWIW what it looks like to me:
I also read them as relating to different lifecycles or scopes, in that project.dart is about an individual Flutter project while android_sdk.dart is cross-project and meant to behave the same across whatever Flutter project (or none) you might currently be working on.
But one of those lifecycles is nested inside the other: when you're working on an individual Flutter project, you're going to be using not only some information that's specific to that project but also some of the information that applies across all projects. So while it wouldn't make sense to have android_sdk.dart import from project.dart, it's perfectly fine and reasonable to go in the reverse direction.
In fact, looking at project.dart, it has an import of gradle_utils.dart; and that in turn imports android_sdk.dart. So there's already a transitive import in project.dart of android_sdk.dart.

Unfortunately even though I have android studio installed (an internal version used at google) flutter is not using android studios version of java

One possible cause would be #121925. If your internal version is at least as new/bleeding-edge as the current public canary ("Giraffe"), and given that you're on macOS, then that seems likely.
With the diagnosis in https://github.com/flutter/flutter/issues/121925#issuecomment-1459501923 , it should be possible to tell if your internal version is triggering the same issue.

Dropping the priority of this bug to correctly reflect the status of the Migrate command as lower than https://github.com/flutter/flutter/issues/123917

I have code that gets the java version, parses it and that code is not executing as a part of flutter analyze --suggestitions.
https://github.com/flutter/flutter/pull/123916/
Updates will move to the doc or the open pr's.

From some examples @reidbaker pointed out in the doc, I'm convinced that an auto-migration for this should stay fairly minimal about when it applies. That's because a Gradle upgrade:

can introduce warnings, which many projects treat as breaking the build;
can IIUC sometimes cause errors — potentially that's always due to something misusing Gradle APIs in some way, but
the error messages can be unhelpful for tracking down what code is at fault (no surprise, given how awful the Gradle error message at the root of this issue thread is); and
the error might in any case lie not in the app's own code, but in some dependency.

Probably this means the tool should only automatically migrate to a newer Gradle when it's highly confident that not doing so would lead to a broken build, like because it can see the JDK version is a newer one that the existing Gradle version doesn't support. That's the strategy taken in #124085.

In a new project currently, I see the gradle version set it 7.5:
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip

Can this be considered fixed and hence, can we close this issue?

New projects get a recent version of Gradle, but this issue is about migrating old projects.
I believe #124085 will fix it, though.

Okay thanks @gnprice for the clarification :) I'll update the labels to reflect the current status of the issue

Last step on this PR is to get a cherry pick landed in 3.10. After that @gmackall can close this ticket.

The cherry-pick of the migrator for this issue just landed and many of the other issues that were referencing this as a tracker have been resolved, so I'm going to close this as completed!
https://github.com/flutter/flutter/pull/126093#issuecomment-1548679586

authors: Rexios80 christopherfujino exaby73 gmackall gnprice reidbaker


text:
Flutter fails to render the last saved changes made to code after the app is relaunched.

Steps to Reproduce

Create a fresh flutter project from flutter stable channel v3.7.9.
Run the app
Make a simple text change, say from A to B
Close the app and relaunch again (not force stop or removing app from recents)
The updated data is not rendered but shows the previous data, (Shows A, instead of B)
If you do ctrl save or save the file in which u made the change, the UI will then show B.

Expected results:
Should show B
Actual results:
Shows A instead of B
Lemme know if i need to provide any additional information. I have attached verbose logs in the pastebin

Code sample
You can recreate the code yourself as well by creating flutter project from stable branch
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 Demo',
      theme: ThemeData(

        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {

      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {

    return Scaffold(
      appBar: AppBar(

        title: Text(widget.title),
      ),
      body: Center(

        child: Column(

          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'flutter ui not updated',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headlineMedium,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

Logs
Verbose logs:
https://katb.in/verboselogs
Flutter analyze:
@Milind ➜ hello  flutter analyze
Analyzing hello...
No issues found! (ran in 2.7s)

flutter doctor -v:
@Milind ➜ ~ flutter doctor -v
[✓] Flutter (Channel stable, 3.7.9, on Microsoft Windows [Version 10.0.22621.1485], locale en-IN)
    • Flutter version 3.7.9 on channel stable at C:\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 62bd79521d (4 days ago), 2023-03-30 10:59:36 -0700
    • Engine revision ec975089ac
    • Dart version 2.19.6
    • DevTools version 2.20.1

[✓] Windows Version (Installed version of Windows is version 10 or higher)

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at C:\Users\Lenovo\AppData\Local\Android\Sdk
    • Platform android-33-ext4, build-tools 33.0.1
    • ANDROID_SDK_ROOT = C:\Users\Lenovo\AppData\Local\Android\Sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-9505619)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[!] Visual Studio - develop for Windows (Visual Studio Community 2022 17.4.4)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.4.33213.308
    ✗ Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop
      development with C++" workload, and include these components:
        MSVC v142 - VS 2019 C++ x64/x86 build tools
         - If there are multiple build tool versions available, install the latest
        C++ CMake tools for Windows
        Windows 10 SDK

[✓] Android Studio (version 2022.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-9505619)

[✓] VS Code, 64-bit edition (version 1.77.0)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 3.60.0

[✓] Connected device (4 available)
    • 2109119DI (mobile) • 417812e0 • android-arm64  • Android 13 (API 33)
    • Windows (desktop)  • windows  • windows-x64    • Microsoft Windows [Version 10.0.22621.1485]
    • Chrome (web)       • chrome   • web-javascript • Google Chrome 111.0.5563.147
    • Edge (web)         • edge     • web-javascript • Microsoft Edge 111.0.1661.62

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

Screen Recording:
https://user-images.githubusercontent.com/45682747/229568632-427116ad-e22e-4c91-a2f8-10748ae306f6.mp4

Thanks for clarifying 👍👍


text:
Machine mac-39 lost external connection from iPhone device.

Machine mac-39 lost external connection from iPhone device.

External connection has been restored by rebooting the machine.


text:
linux engine_release_builder timing out on host_engine on flutter-3.16-candidate.10

https://ci.chromium.org/ui/p/dart-internal/builders/flutter/Linux Production Engine Drone/26352/overview
This is preventing CPs from being processed (b/306089854)

Casey reran this a couple of times and all of them are timing out due to the Linux host_engine tests taking too long to run. Is there a good way to confirm this isn't an issue from the tests themselves?

Removing from ticket queue.

https://github.com/flutter/engine/pull/47112 fixed this. Thank you @jason-simmons !


text:
Certain images fail to render at all

Is there an existing issue for this?

[X] I have searched the existing issues
[X] I have read the guide to filing a bug

Steps to reproduce
I've never had a problem with images rendering, but images coming from Edmunds server do not render at all.  I'm not sure what or why is the connection.  The images render just fine in any web browser
The image in question is:
https://media.ed.edmunds-media.com/toyota/highlander/2023/oem/2023_toyota_highlander_4dr-suv_limited_fq_oem_1_815.jpg
I am not getting any meaningful errors catched anywhere.  Just no picture rendered.
Expected results
Image should render
Actual results
Image does not render
Code sample
Code sample
Image.network(
                    'https://media.ed.edmunds-media.com/toyota/highlander/2023/oem/2023_toyota_highlander_4dr-suv_limited_fq_oem_1_815.jpg',
                  );

Screenshots or Video

Screenshots / Video demonstration
[Upload media here]

Logs
Logs
[Paste your logs here]

Flutter Doctor output
Doctor output
Flutter 3.18.0-7.0.pre.36 • channel master • https://github.com/flutter/flutter.git
Framework • revision e31ac61813 (5 hours ago) • 2023-12-07 17:28:32 -0800
Engine • revision 6a687bef2c
Tools • Dart 3.3.0 (build 3.3.0-200.0.dev) • DevTools 2.30.0

Tried reproducing this on Android and iOS, but the image rendered as expected.
Possibly something changed in the image on the Edmunds site?

I also checked this again on Flutter master channel and see it's only reproducible on Web whilst the image is rendered well on Android and iOS Flutter apps. So I think it would be something to fix for CORS issue on the backend side.

flutter doctor -v (stable and master)
[✓] Flutter (Channel stable, 3.16.7, on macOS 14.1 23B74 darwin-x64, locale en-VN)
    • Flutter version 3.16.7 on channel stable at /Users/huynq/Documents/GitHub/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ef1af02aea (6 hours ago), 2024-01-11 15:19:26 -0600
    • Engine revision 4a585b7929
    • Dart version 3.2.4
    • DevTools version 2.28.5

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/huynq/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/huynq/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A507
    • CocoaPods version 1.14.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.1)
    • Android Studio at /Applications/Android Studio Hedgehog.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)

[✓] Android Studio (version 2022.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • android-studio-dir = /Applications/Android Studio.app/
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] VS Code (version 1.85.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.80.0

[✓] Connected device (3 available)
    • RMX2001 (mobile) • EUYTFEUSQSRGDA6D • android-arm64  • Android 11 (API 30)
    • macOS (desktop)  • macos            • darwin-x64     • macOS 14.1 23B74 darwin-x64
    • Chrome (web)     • chrome           • web-javascript • Google Chrome 120.0.6099.216

[✓] Network resources
    • All expected network resources are available.

• No issues found!

[!] Flutter (Channel master, 3.19.0-4.0.pre.41, on macOS 14.1 23B74 darwin-x64, locale en-VN)
    • Flutter version 3.19.0-4.0.pre.41 on channel master at /Users/huynq/Documents/GitHub/flutter_master
    ! Warning: `flutter` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
    ! Warning: `dart` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision e20e95100d (48 minutes ago), 2024-01-11 19:00:06 -0800
    • Engine revision 44a0a6ee4d
    • Dart version 3.4.0 (build 3.4.0-16.0.dev)
    • DevTools version 2.31.0
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/huynq/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/huynq/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A507
    • CocoaPods version 1.14.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.1)
    • Android Studio at /Applications/Android Studio Hedgehog.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)

[✓] Android Studio (version 2022.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • android-studio-dir = /Applications/Android Studio.app/
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] VS Code (version 1.85.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.80.0

[✓] Connected device (3 available)
    • RMX2001 (mobile) • EUYTFEUSQSRGDA6D • android-arm64  • Android 11 (API 30)
    • macOS (desktop)  • macos            • darwin-x64     • macOS 14.1 23B74 darwin-x64
    • Chrome (web)     • chrome           • web-javascript • Google Chrome 120.0.6099.216

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

@mark8044 can you confirm this issue as well?

@huycozy @jason-simmons
Agreed, the issue is resolved for me now on the latest master channel.
Flutter 3.19.0-9.0.pre.36 • channel master • https://github.com/flutter/flutter.git
Framework • revision 788614d171 (2 days ago) • 2024-01-20 00:19:16 +0200
Engine • revision f2b441a264
Tools • Dart 3.4.0 (build 3.4.0-47.0.dev) • DevTools 2.31.0

Either Edmunds has fixed something on their side or somewhere along the way something got fixed on master branch.   From my end this is no longer an issue 👍

Thanks for confirming this. Closing the issue as fixed.

authors: huycozy jason-simmons mark8044


text:
Crash on Google Sign-In on iOS

Steps to reproduce

New flutter project with flutter create + new FireBase project
Followed this guide to setup firebase_ui_auth with google sign in.
Launch iOS emulator
flutter run

Expected results
I expect to be able to click the "Sign in with Google" button and be prompted with a google sign in modal.
Actual results
On iOS the flutter app immediately crashes when I click the "Sign In with Google" button. On android emulator and in the web, it works perfectly fine and logs in successfully, but crashes consistently on iOS. After crashing it dumps out the following crash log.
crash.txt
Code sample
Link to my repo 👉 https://github.com/lineville/bewell
Screenshots or Video

Screenshots / Video demonstration
https://github.com/flutter/flutter/assets/25349044/6dfdf5e1-3c9f-4511-9fde-9d56e05d8bd4

Logs
Logs from the crash 👇
Window that says "Runner quit unexpectedly."
crash.txt
Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.19.6, on macOS 14.5 23F5064f darwin-arm64, locale en-US)
    • Flutter version 3.19.6 on channel stable at /Users/lineville/flutter
    • Upstream repository git@github.com:flutter/flutter.git
    • Framework revision 54e66469a9 (2 weeks ago), 2024-04-17 13:08:03 -0700
    • Engine revision c4cd48e186
    • Dart version 3.3.4
    • DevTools version 2.31.1

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/lineville/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/lineville/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15E204a
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)

[✓] VS Code (version 1.88.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.88.0

[✓] VS Code (version 1.85.0-insider)
    • VS Code at /Applications/Visual Studio Code - Insiders.app/Contents
    • Flutter extension version 3.62.0

[✓] VS Code (version 1.72.0-insider)
    • VS Code at /Users/lineville/Downloads/Visual Studio Code - Insiders.app/Contents
    • Flutter extension version 3.62.0

[✓] Connected device (4 available)
    • sdk gphone64 arm64 (mobile) • emulator-5554                        • android-arm64  • Android 14 (API 34) (emulator)
    • iPhone 15 (mobile)          • 56E2AD3E-04E0-455A-B8B9-EFA1F1025202 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-17-2 (simulator)
    • macOS (desktop)             • macos                                • darwin-arm64   • macOS 14.5 23F5064f darwin-arm64
    • Chrome (web)                • chrome                               • web-javascript • Google Chrome 124.0.6367.94

[✓] Network resources
    • All expected network resources are available.

• No issues found!

A couple more bits of info for context.

This worked at some point, and began being an issue about a week ago -- could be related to a recent macOS update, package update or something of that nature.
I also tried out a blank react native app and implemented google sign in and observed a similar behavior where it worked fine on android and web but crashed immediately on iOS. This makes me think there's a chance it's something specific to google sign in on iOS and not necessarily a flutter problem.
Other auth providers like email sign-in and apple sign in work fine on iOS.


text:
Navigator forces expand size constraint.

I found that I wanted to use the a Step like UX where the user can proceed through a series of steps. The back button on Android should take them to the previous step. This should appear in a dialog.
I found when you use a Navigator it forces the contents to max constraints, which means the dialog must fill the screen. I feel that Navigator is a almost has a "Semantic" meaning that it controls the routes and history back stack, and its parent should constrain where the stack/transitions occur. I believe it is a bug for the constraint resolution to come from the Navigator.
From what I can tell with the Flutter Inspector the root cause is that Navigator returns an Overlay widget that contains a Stack with fit: StackFit.expand.
I've included a small example below for testing. I'm not setup to build the engine repo, or I would have tested my supposition above. It would be great to get some feedback if this is the problem, and if an optional fit parameter put on Navigator/Overlay so its not forced.
@Hixie I assume you want to know about this for your Navigator work.
Steps to Reproduce
Example Code
import 'package:flutter/material.dart';

void main() => runApp(new MainWidget());

class MainWidget extends StatelessWidget {
	@override
	Widget build(BuildContext context) {
		return new MaterialApp(
			home: new Scaffold(
				backgroundColor: Colors.lightBlue,
				body: new AlertDialog(
					title: const Text('Help'),
					content: new Navigator(
						initialRoute: 'step:1',
						onGenerateRoute: _onGenerateRoute,
					),
				),
			),
		);
	}

	Route<dynamic> _onGenerateRoute(RouteSettings settings) {
		var parts = settings.name.split(':');
		return new PageRouteBuilder(
			pageBuilder: (_, __, ___) => new StepWidget(int.parse(parts[1], radix: 10)),
			transitionsBuilder: (BuildContext _, Animation<double> animation, Animation<double> secondary, Widget child) {
				child = new SlideTransition(
					position: new Tween<Offset>(
						begin: Offset.zero,
						end: const Offset(-1.0, 0.0),
					).animate(secondary),
					child: child,
				);
				child = new SlideTransition(
					position: new Tween<Offset>(
						begin: const Offset(1.0, 0.0),
						end: Offset.zero,
					).animate(animation),
					child: child,
				);
				return child;
			}
		);
	}
}

class StepWidget extends StatelessWidget {
	final int step;

	StepWidget(this.step);

	@override
	Widget build(BuildContext context) {
		return new Column(
			mainAxisSize: MainAxisSize.min,
			children: <Widget>[
				new Container(
					padding: const EdgeInsets.all(48.0),
					child: new Text('Step $step'),
				),
				new Row(
					mainAxisSize: MainAxisSize.max,
					children: <Widget>[
						new Expanded(
							child: new FlatButton(
								child: const Text('Prev'),
								onPressed: () => Navigator.of(context).maybePop(),
							),
						),
						new Expanded(
							child: new FlatButton(
								child: const Text('Next'),
								onPressed: () => Navigator.of(context).pushNamed('step:${step + 1}'),
							),
						),
					],
				),
			],
		);
	}
}

Flutter Doctor
√] Flutter (on Microsoft Windows [Version 10.0.14393], locale en-GB, channel master)
    • Flutter version 0.1.1-pre.33 at C:\Android\flutter
    • Framework revision d401bd78ae (8 days ago), 2018-02-13 01:56:13 -0800
    • Engine revision f5a4a93787
    • Tools Dart version 2.0.0-dev.22.0
    • Engine Dart version 2.0.0-edge.32396138ff733cbe8d9ac32178e6cffccdf80644

[√] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at C:\Android\SDK
    • Android NDK at C:\Android\SDK\ndk-bundle
    • Platform android-27, build-tools 27.0.3
    • ANDROID_HOME = C:\Android\SDK
    • Java binary at: C:\Android\Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)

[√] Android Studio (version 3.0)
    • Android Studio at C:\Android\Studio
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)

[√] IntelliJ IDEA Community Edition (version 2017.3)
    • Flutter plugin version 21.2.3
    • Dart plugin version 173.4548.30

[√] Connected devices
    • Google Nexus 5X, 7 1 0, API 25, 1080x1920 • 192.168.188.101:5555 • android-x86 • Android 7.1.1 (API 25)

• No issues found!

Hi, Is it possible to make the browser adapt to the size of the child?

Hi,

Here is an even simpler example to showcase this issue

import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      color: Colors.white,
      home: Center(
        child: Navigator(
          pages: [
            MaterialPage(
              child: ProfileWidget(),
            ),
          ],
          onPopPage: (_, __) {
            return false;
          },
        ),
      ),
    );
  }
}

class ProfileWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.red,
      height: 200,
    );
  }
}

Given result

Expected result

The Expected result was obtained be moving the Center widget in the MaterialPage.
This is problematic because it means that we would have to duplicate this constraint in every Page rather than having it only once on top of Navigator.
Could we at least have some feedback on whether this is considered as a bug and will be fixed or if we should just duplicate and move the constraint down?

Is there any progress on this issue？

Is there any progress on this issue？

Doesn't seem so... I am also interested on this topic. Does anyone know a workaround?

Because of this problem, it is impossible to implement nested navigation in dialogs without expanding them to full screen. If this UI is a required part of the application, developers will not be able to implement it and will have to change Flutter to something else.

I'm not sure I really understand the issue here. You can wrap the Navigator in whatever widget you like to change the constraints passed to the Navigator, and you can wrap the Navigator's children with whatever widgets you like to have them treat their constraints however is desired, including using Positioned to make them not be expanded by default. If someone wanted to make the Overlay and Navigator widgets configurable so that e.g. Overlay's computeDryLayout didn't just always use constraints.biggest, that might also be possible (it would depend on the benchmark results), but it would be good to better explain the use case first.

We've just stumbled upon this issue trying to implement navigation in a bottom sheet which should in theory automatically adjust its height to the current route. Could you provide an example of how to solve this? @Hixie
This stackoverflow question has some good imagery to explain the issue: https://stackoverflow.com/questions/68964864/make-nested-navigator-widget-wrap-child-in-column

I recently found a workaround but not sure if it is good to use.
Just wrap the Navigator with IntrinsicHeight (which was warned that the class is relatively expensive).

Yeah, this is a workaround. Unfortunately, this does not work when you use LayoutBuilder below Navigator, because LayoutBuilder can not calculate intrinsic sizes.

Does anyone know a package that provides this feature? It's very sad that there is currently no way to do this in Flutter. I really don't care whether the implementation is efficient or not.

Hi all,
same issue here. I would really like to avoid using IntrinsicHeight.

Same issue

Same here, i took me considerable time to figure out that the issue was not related to auto_route, but with flutter itself.

Is there any possibility to push this issue? :)

@nblum37 The primary way to push this issue would be to contract with someone to have them do the work (or to contribute a patch directly). See also https://github.com/flutter/flutter/wiki/Issue-hygiene#when-will-my-bug-be-fixed

authors: DevNico Hixie T-Oner adonisRodxander cirnok lukaskurz lulupointu nblum37 paulkre raulmabe saibotma slightfoot yacineblr yellowgraysu


text:
CanvasKit FragmentShaders do not update uniforms when reusing a Paint object.

Steps to reproduce

Have some kind of Fragment shader that uses a uniform to show something graphically.
Inside a paint() function, create a new Paint object that uses that shader and cache it.
Also in the paint function, if there is a cached version of the Paint object, use that instead of making a new one.
Update the uniforms of the shader
Notice how in the cached version's paint, the changed value is not reflected in the render

Expected results
Each time you update a uniform via setFloat and friends, the value should be reflected in the shader's uniform.
Actual results
The updated uniform simply isn't sent to the shader.
Code sample
Code sample
pubspec.yaml
flutter:
  shaders:
    - shaders/animate_colors.frag

shaders/animate_colors.frag
#include <flutter/runtime_effect.glsl>

uniform float uTime;

out vec4 fragColor;

void main() {
    vec3 tColor = vec3(sin(uTime) * 0.5 + 0.5);
    fragColor = vec4(tColor, 1.0);
}

main.dart
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'dart:ui' as ui;

late final ui.FragmentProgram _shaderProgram;

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  _shaderProgram =
      await ui.FragmentProgram.fromAsset('shaders/animate_colors.frag');

  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> with SingleTickerProviderStateMixin {
  late final MyPainter _painter;
  late final AnimationController _controller;

  @override
  void initState() {
    super.initState();
    _controller = AnimationController(
      duration: const Duration(seconds: 1),
      vsync: this,
    )..repeat();

    _painter = MyPainter(_controller);
  }

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Center(
          child: SizedBox(
            width: 400,
            height: 400,
            child: CustomPaint(
              painter: _painter,
              isComplex: false,
              willChange: true,
            ),
          ),
        ),
      ),
    );
  }
}

class MyPainter extends CustomPainter {
  MyPainter(Listenable listenable) : super(repaint: listenable);

  ui.FragmentShader? _shader;
  ui.Paint? _paint;

  @override
  void paint(Canvas canvas, Size size) {
    // Get the current time from flutter
    final tTime =
        SchedulerBinding.instance.currentFrameTimeStamp.inMilliseconds / 1000;

    final ui.FragmentShader tShader;

    if (_shader == null) {
      tShader = _shader ??= _shaderProgram.fragmentShader();
      _paint = Paint()..shader = tShader;
    } else {
      tShader = _shader!;
    }

    tShader.setFloat(0, tTime); // uTime in seconds

    final tRect = Rect.fromLTWH(0, 0, size.width, size.height);
    canvas.drawRect(tRect, _paint!);
  }

  @override
  bool shouldRepaint(MyPainter oldDelegate) {
    return true;
  }
}

Screenshots or Video

Screenshots / Video demonstration
[Upload media here]

Logs
Logs
[Paste your logs here]

Flutter Doctor output
Doctor output
flutter doctor -v
[✓] Flutter (Channel stable, 3.22.1, on macOS 13.6.3 22G436 darwin-arm64, locale
    en-CA)
    • Flutter version 3.22.1 on channel stable at
      XXXXXX
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision a14f74ff3a (2 weeks ago), 2024-05-22 11:08:21 -0500
    • Engine revision 55eae6864b
    • Dart version 3.4.1
    • DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at XXXXX/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = XXXXXX/Library/Android/sdk
    • ANDROID_SDK_ROOT = XXXXXX/Library/Android/sdk
    • Java binary at: /Applications/Android
      Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      17.0.7+0-17.0.7b1000.6-10550314)
    • All Android licenses accepted.

[!] Xcode - develop for iOS and macOS (Xcode 15.0.1)
    • Xcode at /Applications/Xcode-15.0.1.app/Contents/Developer
    • Build 15A507
    ✗ Unable to get list of installed Simulator runtimes.
    • CocoaPods version 1.14.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      17.0.7+0-17.0.7b1000.6-10550314)

[✓] VS Code (version 1.90.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.91.20240529

[✓] Connected device (3 available)
    • macOS (desktop)                 • macos                 • darwin-arm64   •
      macOS 13.6.3 22G436 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin         •
      macOS 13.6.3 22G436 darwin-arm64
    • Chrome (web)                    • chrome                • web-javascript •
      Google Chrome 125.0.6422.142

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

try  this code
  MyPainter(Listenable listenable) : super(repaint: listenable);

  ui.FragmentShader? _shader;
  ui.Paint? _paint;

  @override
  void paint(Canvas canvas, Size size) {
    // Get the current time from flutter
    final tTime =
        SchedulerBinding.instance.currentFrameTimeStamp.inMilliseconds / 1000;

    final ui.FragmentShader tShader;

    if (_shader == null) {
      tShader = _shader ??= _shaderProgram.fragmentShader();
    } else {
      tShader = _shader!;
    }

    tShader.setFloat(0, tTime); // uTime in seconds

    // Ensure that the paint object uses the updated shader
    _paint = Paint()..shader = tShader;

    final tRect = Rect.fromLTWH(0, 0, size.width, size.height);
    canvas.drawRect(tRect, _paint!);
  }

  @override
  bool shouldRepaint(MyPainter oldDelegate) {
    return true;
  }
}
``

I've made a fix for this in the linked PR.

Thanks for the report. Reproduced the issue on Web in canvaskit renderer. The issue doesn't happen on Android app.

Demo

Web (canvaskit renderer)
Android app

flutter doctor -v (stable and master)
[✓] Flutter (Channel stable, 3.22.1, on macOS 14.1 23B74 darwin-x64, locale en-VN)
    • Flutter version 3.22.1 on channel stable at /Users/huynq/Documents/GitHub/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision a14f74ff3a (13 days ago), 2024-05-22 11:08:21 -0500
    • Engine revision 55eae6864b
    • Dart version 3.4.1
    • DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/huynq/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/huynq/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
    • Xcode at /Applications/Xcode15.3.app/Contents/Developer
    • Build 15E204a
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • android-studio-dir = /Applications/Android Studio.app/
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)

[✓] VS Code (version 1.89.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.90.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 14.1 23B74 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 125.0.6422.142

[✓] Network resources
    • All expected network resources are available.

• No issues found!

[!] Flutter (Channel master, 3.23.0-13.0.pre.117, on macOS 14.1 23B74 darwin-x64, locale en-VN)
    • Flutter version 3.23.0-13.0.pre.117 on channel master at /Users/huynq/Documents/GitHub/flutter_master
    ! Warning: `flutter` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
    ! Warning: `dart` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d3a273971c (44 minutes ago), 2024-06-05 21:45:25 -0400
    • Engine revision f51e0ad3ab
    • Dart version 3.5.0 (build 3.5.0-226.0.dev)
    • DevTools version 2.36.0
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/huynq/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/huynq/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
    • Xcode at /Applications/Xcode15.3.app/Contents/Developer
    • Build 15E204a
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • android-studio-dir = /Applications/Android Studio.app/
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)

[✓] VS Code (version 1.89.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.90.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 14.1 23B74 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 125.0.6422.142

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

authors: Moncader huycozy mr-durjoy


text:
I am createing GNav() widget that moves between screens and it shows me this error 'package:flutter/src/widgets/framework.dart': Failed assertion: line 5207 pos 16: 'owner!._debugCurrentBuildTarget == this': is not true. and this my code

Steps to reproduce
the error masseg tells me that the error is scaffold()
this is my code :
import 'package:flutter/material.dart';
import 'package:go_gas/Screens/Bottom%20Navigation%20Bar/favorite.dart';
import 'package:go_gas/Screens/Bottom%20Navigation%20Bar/home_screen.dart';
import 'package:go_gas/Screens/Bottom%20Navigation%20Bar/more_options.dart';
import 'package:go_gas/Screens/Bottom%20Navigation%20Bar/search.dart';
import 'package:google_nav_bar/google_nav_bar.dart';
class BottomNavBarScreen extends StatefulWidget {
const BottomNavBarScreen({super.key});
@override
State createState() {
return _BottomNavBarScreenState();
}
}
class _BottomNavBarScreenState extends State {
int _screenIndex = 0;
static const List _screens = [
HomeScreen(),
Search(),
Favorite(),
MoreOptions(),
];
@override
Widget build(BuildContext context) {
return Scaffold(
body: _screens.elementAt(_screenIndex),
  bottomNavigationBar: Center(
    child: GNav(
      tabs: const [
            GButton(icon: Icons.home, text:'Home'),
            GButton(icon: Icons.search, text:'Search'),
            GButton(icon: Icons.favorite, text:'Favorite'),
            GButton(icon: Icons.more_horiz, text:'More Option'),
      ],
      selectedIndex: _screenIndex,
      onTabChange: (index){
        setState(() {
          _screenIndex = index;
        });
      },
    ),
  ),
);

}
}
Expected results
my code should navigate throw diffrint widgets from the navigation bar
Actual results
this is the error message
'package:flutter/src/widgets/framework.dart': Failed assertion: line 5207 pos 16: 'owner!._debugCurrentBuildTarget == this': is not true.
Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=2_bug.yml
The relevant error-causing widget was:
Scaffold Scaffold:file:///C:/Users/User/Desktop/flutterProject/go_gas/lib/Screens/Bottom%20Navigation%20Bar/bottom_nav_bar.dart:28:12
Exception caught by widgets library ═══════════════════════════════════

'package:flutter/src/widgets/framework.dart': Failed assertion: line 5207 pos 16: 'owner!._debugCurrentBuildTarget == this': is not true.
The relevant error-causing widget was:
Code sample
Code sample
import 'package:flutter/material.dart';
import 'package:go_gas/Screens/Bottom%20Navigation%20Bar/favorite.dart';
import 'package:go_gas/Screens/Bottom%20Navigation%20Bar/home_screen.dart';
import 'package:go_gas/Screens/Bottom%20Navigation%20Bar/more_options.dart';
import 'package:go_gas/Screens/Bottom%20Navigation%20Bar/search.dart';
import 'package:google_nav_bar/google_nav_bar.dart';
class BottomNavBarScreen extends StatefulWidget {
const BottomNavBarScreen({super.key});
@override
State createState() {
return _BottomNavBarScreenState();
}
}
class _BottomNavBarScreenState extends State {
int _screenIndex = 0;
static const List _screens = [
HomeScreen(),
Search(),
Favorite(),
MoreOptions(),
];
@override
Widget build(BuildContext context) {
return Scaffold(
body: _screens.elementAt(_screenIndex),
  bottomNavigationBar: Center(
    child: GNav(
      tabs: const [
            GButton(icon: Icons.home, text:'Home'),
            GButton(icon: Icons.search, text:'Search'),
            GButton(icon: Icons.favorite, text:'Favorite'),
            GButton(icon: Icons.more_horiz, text:'More Option'),
      ],
      selectedIndex: _screenIndex,
      onTabChange: (index){
        setState(() {
          _screenIndex = index;
        });
      },
    ),
  ),
);

}
}

Screenshots or Video

Screenshots / Video demonstration
[![image](https://github.com/flutter/flutter/assets/15

2763896/447cfdde-d2eb-493a-9073-bef2aa596f0f)]

Logs
Logs
[Paste your logs here]

Flutter Doctor output
Doctor output
![image](https://github.com/flutter/flutter/assets/152763896/1bd1f1de-9b1c-40c7-b464-023d55dcedae)

maybe try without google_nav_bar
or open an issue here

This is likely an issue with your code. You may be referencing your BottomNavBarScreen incorrectly.
Given the lack of a fully runnable code sample and the fact that this could also be an issue with the third-party package you're using, I'll be closing this issue.
Please file a new issue and provide a complete runnable code sample without any third-party packages so that it can be properly investigated.
Thank you

authors: MohammedRedha126 danagbemava-nc iapicca


text:
lib/util/html_type.dart:28:8: Error: Error when reading 'lib/util/helper/get_di.dart': The system cannot find the path specified.

Steps to reproduce
flutter run -d chrome --web-hostname localhost --web-port 5000

Expected results
Run localhost
Actual results
Launching lib\main.dart on Chrome in debug mode...
lib/util/html_type.dart:28:8: Error: Error when reading 'lib/util/helper/get_di.dart': The system cannot find the path specified.

import 'helper/get_di.dart' as di;
       ^
lib/features/html/screens/html_viewer_screen.dart:15:9: Error: Type 'HtmlType' not found.
  final HtmlType htmlType;
        ^^^^^^^^
lib/features/html/controllers/html_controller.dart:12:28: Error: Type 'HtmlType' not found.
  Future<void> getHtmlText(HtmlType htmlType) async {
                           ^^^^^^^^
lib/features/html/domain/repositories/html_repository.dart:13:32: Error: Type 'HtmlType' not found.
  Future<Response> getHtmlText(HtmlType htmlType) async {
                               ^^^^^^^^
lib/features/html/domain/repositories/html_repository_interface.dart:5:31: Error: Type 'HtmlType' not found.
  Future<dynamic> getHtmlText(HtmlType htmlType);
                              ^^^^^^^^
lib/features/html/domain/services/html_service.dart:11:32: Error: Type 'HtmlType' not found.
  Future<Response> getHtmlText(HtmlType htmlType) async {
                               ^^^^^^^^
lib/features/html/domain/services/html_service_interface.dart:5:32: Error: Type 'HtmlType' not found.
  Future<Response> getHtmlText(HtmlType htmlType);
                               ^^^^^^^^
lib/helper/route_helper.dart:425:67: Error: Undefined name 'HtmlType'.
      htmlType: Get.parameters['page'] == 'terms-and-condition' ? HtmlType.termsAndCondition
                                                                  ^^^^^^^^
lib/helper/route_helper.dart:426:58: Error: Undefined name 'HtmlType'.
          : Get.parameters['page'] == 'privacy-policy' ? HtmlType.privacyPolicy
                                                         ^^^^^^^^
lib/helper/route_helper.dart:427:59: Error: Undefined name 'HtmlType'.
          : Get.parameters['page'] == 'shipping-policy' ? HtmlType.shippingPolicy
                                                          ^^^^^^^^
lib/helper/route_helper.dart:428:63: Error: Undefined name 'HtmlType'.
          : Get.parameters['page'] == 'cancellation-policy' ? HtmlType.cancellation
                                                              ^^^^^^^^
lib/helper/route_helper.dart:429:57: Error: Undefined name 'HtmlType'.
          : Get.parameters['page'] == 'refund-policy' ? HtmlType.refund : HtmlType.aboutUs,
                                                        ^^^^^^^^
lib/helper/route_helper.dart:429:75: Error: Undefined name 'HtmlType'.
          : Get.parameters['page'] == 'refund-policy' ? HtmlType.refund : HtmlType.aboutUs,
                                                                          ^^^^^^^^
lib/util/html_type.dart:73:57: Error: Method not found: 'init'.
  Map<String, Map<String, String>> languages = await di.init();
                                                        ^^^^
lib/features/html/screens/html_viewer_screen.dart:15:9: Error: 'HtmlType' isn't a type.
  final HtmlType htmlType;

Code sample
Code sample
[Paste your code here]

Screenshots or Video

Screenshots / Video demonstration
[Upload media here]

Logs
No response
Flutter Doctor output
Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.22.0, on Microsoft Windows [Version 10.0.22631.4169], locale vi-VN)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Build Tools 2022 17.4.4)
[√] Android Studio (version 2023.1)
[√] Android Studio (version 2024.1)
[√] Connected device (3 available)
[√] Network resources

• No issues found!

Hi @sakevn, please provide the full output of flutter run -v. Please also provide a complete minimal reproducible code sample so that we can properly investigate this issue.
Thank you

authors: danagbemava-nc sakevn