getx icon indicating copy to clipboard operation
getx copied to clipboard

Beta 5.0 has error on Get.arguments

Open timfong888 opened this issue 2 years ago • 1 comments

ATTENTION: DO NOT USE THIS FIELD TO ASK SUPPORT QUESTIONS. USE THE PLATFORM CHANNELS FOR THIS. THIS SPACE IS DEDICATED ONLY FOR BUGS DESCRIPTION. Fill in the template. Issues that do not respect the model will be closed.

Describe the bug A clear and concise description of what the bug is.

When I used Beta 5.0, Get.arguments returns a Map List error. When I switch back to production in pubspec.yaml, it works.

But not after a week of trying to figure out what I did to break it.

Reproduction code NOTE: THIS IS MANDATORY, IF YOUR ISSUE DOES NOT CONTAIN IT, IT WILL BE CLOSED PRELIMINARY)

example: First I route and that's where I pass the values:

Get.toNamed('/landingPage', arguments: {
      "referralID": "$passedReferralID",
      "creatorID": "$passedCreatorID",
      "campaignID": "$passedCampaignID"
    });

Then I try to retrieve it as a value in the route.

import 'package:get/get.dart';

class LandingPageWidget extends StatefulWidget {
  const LandingPageWidget({Key key}) : super(key: key);

  @override
  _LandingPageWidgetState createState() => _LandingPageWidgetState();
}

class _LandingPageWidgetState extends State<LandingPageWidget> {
  final scaffoldKey = GlobalKey<ScaffoldState>();

  @override
  void initState() {
    debugPrint("override in landing page initState");
    super.initState();
    logFirebaseEvent('screen_view', parameters: {'screen_name': 'landingPage'});

    debugPrint(Get.arguments);
    // print(Get.arguments[0]);
    // debugPrint(Get.arguments['referralID']);

    String passedReferralID = Get.arguments['referralID'];
    print(passedReferralID);

    // setState(() => FFAppState().localReferralID = passedReferralID);
  }

To Reproduce I would be curious if anyone else has the problem in their own script.

The key workflow I have in mine is:

  1. Get.toNamed(/route, arguments)
  2. Get.arguments from the named Route

Expected behavior A clear and concise description of what you expected to happen.

I expect the named route to be able to retrieve Get.arguments. Works in stable, error in beta.

Screenshots If applicable, add screenshots to help explain your problem.

Flutter Version: Enter the version of the Flutter you are using

Getx Version: get: ^4.6.5 works get: ^5.0.0-beta.51 did not for me

Describe on which device you found the bug: ex: Moto z2 - Android.

Minimal reproduce code Provide a minimum reproduction code for the problem

timfong888 avatar Jul 18 '22 17:07 timfong888

Same issue ,did you got any solution?

pradeep14598 avatar Aug 24 '22 14:08 pradeep14598

A-->B--C

我遇到的情况:

 A--> B 传递参数1,B-->C 传递参数2,然后再B页面打印 Get.arguments 内容,结果B界面的Get.arguments 变成了 2,而不是A传递到B的 1

yjt1216 avatar Oct 17 '22 06:10 yjt1216