Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making DropdownButtonFormField to re-render if parent widget changes #1

Closed
wants to merge 2 commits into from

Conversation

pedromassango
Copy link
Owner

Description

I'm just making DropdownButtonFormField to show new value by overrrinding the didUpdateWidget() function and replacing the current value with the new widget instance's value.

Related Issues

flutter#56898

Tests

I added the following tests:

Replace this with a list of the tests that you added as part of this PR. A change in behaviour with no test covering it
will likely get reverted accidentally sooner or later. PRs must include tests for all changed/updated/fixed behaviors. See [Test Coverage].

Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I signed the [CLA].
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

  • No, no existing tests failed, so this is not a breaking change.

@jlubeck
Copy link

jlubeck commented May 12, 2020

I can confirm this fixes my issue: flutter#57006
And I'm assuming it will also fix flutter#56898

Added test that assert that: DropdownButtonFormField should re-render if value param changes
@pedromassango pedromassango marked this pull request as ready for review May 12, 2020 18:26
@shihaohong
Copy link

I think you might have accidentally closed the PR. A closed PR cannot be reviewed until it is reopened.

@pedromassango
Copy link
Owner Author

This was moved to flutter#57037

@shihaohong
Copy link

Ahh, I think it's because this PR was opened against your own master branch. My mistake

@pedromassango
Copy link
Owner Author

Yes you got me. Ahhh

pedromassango pushed a commit that referenced this pull request Dec 9, 2020
…1498)" (flutter#71519)

This appears to be triggering an null dereference by calling
popSystemNavigator on a null platform plugin delegate.

boolean io.flutter.plugin.platform.PlatformPlugin$PlatformPluginDelegate.popSystemNavigator()

Relevant logs:
```
2020-12-01T14:34:34.410242: stderr: [   +6 ms] VMServiceFlutterDriver: >>> {command: get_text, finderType: ByValueKey, keyValueString: status, keyValueType: String}
2020-12-01T14:34:34.490211: stderr: [  +79 ms] VMServiceFlutterDriver: <<< {isError: false, response: {text: ok}, type: _extensionType, method: ext.flutter.driver}
2020-12-01T14:34:34.493011: stderr: [   +2 ms] VMServiceFlutterDriver: >>> {command: tap, finderType: ByValueKey, keyValueString: step, keyValueType: String}
2020-12-01T14:34:34.962001: stdout: [ +468 ms] E/MethodChannel#flutter/platform( 9732): Failed to handle method call
2020-12-01T14:34:34.962222: stdout: [        ] E/MethodChannel#flutter/platform( 9732): java.lang.NullPointerException: Attempt to invoke interface method 'boolean io.flutter.plugin.platform.PlatformPlugin$PlatformPluginDelegate.popSystemNavigator()' on a null object reference
2020-12-01T14:34:34.962356: stdout: [        ] E/MethodChannel#flutter/platform( 9732):   at io.flutter.plugin.platform.PlatformPlugin.popSystemNavigator(PlatformPlugin.java:313)
2020-12-01T14:34:34.962499: stdout: [        ] E/MethodChannel#flutter/platform( 9732):   at io.flutter.plugin.platform.PlatformPlugin.access$600(PlatformPlugin.java:28)
2020-12-01T14:34:34.962735: stdout: [        ] E/MethodChannel#flutter/platform( 9732):   at io.flutter.plugin.platform.PlatformPlugin$1.popSystemNavigator(PlatformPlugin.java:101)
2020-12-01T14:34:34.963047: stdout: [        ] E/MethodChannel#flutter/platform( 9732):   at io.flutter.embedding.engine.systemchannels.PlatformChannel$1.onMethodCall(PlatformChannel.java:123)
2020-12-01T14:34:34.963284: stdout: [        ] E/MethodChannel#flutter/platform( 9732):   at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
2020-12-01T14:34:34.963592: stdout: [        ] E/MethodChannel#flutter/platform( 9732):   at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
2020-12-01T14:34:34.963910: stdout: [        ] E/MethodChannel#flutter/platform( 9732):   at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:738)
2020-12-01T14:34:34.964227: stdout: [        ] E/MethodChannel#flutter/platform( 9732):   at android.os.MessageQueue.nativePollOnce(Native Method)
2020-12-01T14:34:34.964571: stdout: [        ] E/MethodChannel#flutter/platform( 9732):   at android.os.MessageQueue.next(MessageQueue.java:323)
2020-12-01T14:34:34.964805: stdout: [        ] E/MethodChannel#flutter/platform( 9732):   at android.os.Looper.loop(Looper.java:136)
2020-12-01T14:34:34.965034: stdout: [        ] E/MethodChannel#flutter/platform( 9732):   at android.app.ActivityThread.main(ActivityThread.java:6123)
2020-12-01T14:34:34.965248: stdout: [        ] E/MethodChannel#flutter/platform( 9732):   at java.lang.reflect.Method.invoke(Native Method)
2020-12-01T14:34:34.965398: stdout: [        ] E/MethodChannel#flutter/platform( 9732):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
2020-12-01T14:34:34.965589: stdout: [        ] E/MethodChannel#flutter/platform( 9732):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
2020-12-01T14:34:34.966863: stderr: [   +1 ms] VMServiceFlutterDriver: <<< {isError: false, response: {}, type: _extensionType, method: ext.flutter.driver}
2020-12-01T14:34:34.967698: stderr: [        ] VMServiceFlutterDriver: >>> {command: get_text, finderType: ByValueKey, keyValueString: status, keyValueType: String}
2020-12-01T14:34:34.986399: stdout: [  +18 ms] E/flutter ( 9732): [ERROR:flutter/shell/common/shell.cc(209)] Dart Unhandled Exception: PlatformException(error, Attempt to invoke interface method 'boolean io.flutter.plugin.platform.PlatformPlugin$PlatformPluginDelegate.popSystemNavigator()' on a null object reference, null, java.lang.NullPointerException: Attempt to invoke interface method 'boolean io.flutter.plugin.platform.PlatformPlugin$PlatformPluginDelegate.popSystemNavigator()' on a null object reference
2020-12-01T14:34:34.986682: stdout: [        ] E/flutter ( 9732):   at io.flutter.plugin.platform.PlatformPlugin.popSystemNavigator(PlatformPlugin.java:313)
stdout: [        ] E/flutter ( 9732):   at io.flutter.plugin.platform.PlatformPlugin.access$600(PlatformPlugin.java:28)
2020-12-01T14:34:34.987013: stdout: [        ] E/flutter ( 9732):   at io.flutter.plugin.platform.PlatformPlugin$1.popSystemNavigator(PlatformPlugin.java:101)
2020-12-01T14:34:34.987328: stdout: [        ] E/flutter ( 9732):   at io.flutter.embedding.engine.systemchannels.PlatformChannel$1.onMethodCall(PlatformChannel.java:123)
2020-12-01T14:34:34.987547: stdout: [        ] E/flutter ( 9732):   at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
2020-12-01T14:34:34.987815: stdout: [        ] E/flutter ( 9732):   at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
2020-12-01T14:34:34.988037: stdout: [        ] E/flutter ( 9732):   at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:738)
2020-12-01T14:34:34.988246: stdout: [        ] E/flutter ( 9732):   at android.os.MessageQueue.nativePollOnce(Native Method)
2020-12-01T14:34:34.988470: stdout: [        ] E/flutter ( 9732):   at android.os.MessageQueue.next(MessageQueue.java:323)
2020-12-01T14:34:34.988678: stdout: [        ] E/flutter ( 9732):   at android.os.Looper.loop(Looper.java:136)
2020-12-01T14:34:34.988934: stdout: [        ] E/flutter ( 9732):   at android.app.ActivityThread.main(ActivityThread.java:6123)
2020-12-01T14:34:34.989112: stdout: [        ] E/flutter ( 9732):   at java.lang.reflect.Method.invoke(Native Method)
2020-12-01T14:34:34.989348: stdout: [        ] E/flutter ( 9732):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
2020-12-01T14:34:34.990016: stdout: [        ] E/flutter ( 9732):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
stdout: [        ] E/flutter ( 9732): ), stack trace: #0      JSONMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:159:7)
stdout: [        ] E/flutter ( 9732): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:159:18)
2020-12-01T14:34:34.990374: stdout: [        ] E/flutter ( 9732): <asynchronous suspension>
2020-12-01T14:34:34.990702: stdout: [        ] E/flutter ( 9732): #2      SystemNavigator.pop (package:flutter/src/services/system_navigator.dart:34:5)
2020-12-01T14:34:34.990946: stdout: [        ] E/flutter ( 9732): <asynchronous suspension>
```

This reverts commit 6a84b02.
@pedromassango pedromassango deleted the pedromassango-DBField-Value-Updates branch January 22, 2022 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants