You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While writing my flutter app's initialization / cleanup state, I found this.
Currently registerMethod throws if same method name is registered already.
voidregisterMethod(String name, Function callback) {
if (_methods.containsKey(name)) {
throwArgumentError('There\'s already a method named "$name".');
}
_methods[name] = callback;
}
I thought about writing code to unregister and re-register methods based on the state of the app. But it wasn't easy due to this.
Can this be considered?
Alternatives
I think registerMethod may return disposer callback.
The text was updated successfully, but these errors were encountered:
I don't know all the potential impacts of a unregisterMethod. I think a safer change could be to add an overrideMethod which skips the contains(key), though I haven't thought through all the implications, or whether adding method is breaking change.
Motivation
While writing my flutter app's initialization / cleanup state, I found this.
Currently
registerMethod
throws if same method name is registered already.I thought about writing code to unregister and re-register methods based on the state of the app. But it wasn't easy due to this.
Can this be considered?
Alternatives
I think
registerMethod
may return disposer callback.The text was updated successfully, but these errors were encountered: