riverpod icon indicating copy to clipboard operation
riverpod copied to clipboard

Allow for the dynamic modification of a mutation's label or allow for a mutation to rely on the key's == only.

Open TekExplorer opened this issue 7 months ago • 2 comments

Is your feature request related to a problem? Please describe. My mutations generator currently uses a static map cache of Mutation objects in order to satisfy both the identity requirement and the ability to define labels.

It would be nice if I did not need to do that.

Describe the solution you'd like There are 2 solutions i can imagine

  1. The ability to change a mutation's label as part of the .call
    • This would allow me to define it as a static member of my extension, as i could properly define the label in the getter.
  2. The ability to create a Mutation ex nihilo that relies only on the == of the defined key
    • This would let me create the mutations in the getters on-the-spot, while having them all refer to the same actual mutation.
    • Alternatively, use the label as the identity, though I could see that having issues.

I note that the "correct" way is to define the Mutation objects as static members. However, I cannot dynamically create the label because I do not have a reliable way of knowing what the name of the provider is, and the toString of the provider is usually quite descriptive already.

Alternatively, I continue using the cache, or ditch the label entirely (though i would rather be as compatible as possible with any devtools)

TekExplorer avatar Sep 09 '25 21:09 TekExplorer

I do not understand what you're trying to solve here.

I'd rather not make the Mutation object mutable. Supporting changing the label would make it hard for the devtool to show an up-to-date label.

rrousselGit avatar Sep 10 '25 16:09 rrousselGit

I do not understand what you're trying to solve here.

I'd rather not make the Mutation object mutable. Supporting changing the label would make it hard for the devtool to show an up-to-date label.

I'm not asking to make it mutable, only that i can create the label "on-the-fly" (such as in a getter, where i have more information, such as provider.name)

TekExplorer avatar Sep 11 '25 18:09 TekExplorer