Skip to content

Add dynamic method/instance variable access? #2990

Closed
@DartBot

Description

@DartBot

This issue was originally filed by @snitko


I'm not sure if this issue is implied by the "add reflection" thread here, but I just wanted to be more specific. I want to be able to do something like this

class Model {

  // ... setting instance variables

  Model(Map fields) {
    fields.forEach((k,v) => this[k] = v);
  }

}

It obviously doesn't work, because this doesn't have a []= method. I would be nice to be able to call methods (in this case, setters) dynamically or maybe even set instance variables names dynamically.

Metadata

Metadata

Assignees

No one assigned

    Labels

    closed-duplicateClosed in favor of an existing reporttype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions