Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8569779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:24:58+00:00 2026-06-11T18:24:58+00:00

If I have a class with a setter defined, how do I reference then

  • 0

If I have a class with a setter defined, how do I reference then generated method as a function from an instance of that class. The spec sort of suggests it would be the id of the variable + ‘=” (seems daft), but this doesn’t parse.

So for example:

class Bar {

  set foo(int value) {
  //whatever
  }
}

typedef F(int value);

void main() {
  F f = new Bar().foo=; //Fails, but what should this be??
  f(5);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T18:25:00+00:00Added an answer on June 11, 2026 at 6:25 pm

    The setter is named foo= but this is not something you can reference in the way you want. Even looking at dart:mirrors the MethodMirror (the mirror for object methods including setters) has no way of invoking it. You could easily rewrite this as:

    class Bar {
    
      set foo(int value) {
      //whatever
      }
    }
    
    typedef F(int value);
    
    void main() {
      Bar b = new Bar();
      F f = (int value) => b.foo = value;
      f(5);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Class that has a private variable with a public setter/getter function:
I'm using Java. I want to have a setter method of one class that
I have a class defined like this, with the appropriate getter and setter methods...
i have a class: class MyClass { @Getter @Setter int a; @Getter @Setter int
I have the following classes... class ExpressionBinder<T> { public Func<T> Getter; public Action<T> Setter;
I have class that extend FragmentActivity in it I add fragment to layout as
I have class grades that I need to check if a specific grade is
I've got a class that has a read-only property defined that is actually a
I have a very simple object called CellData. Is defined as: public sealed class
I have an control that is subclassed from ItemsControl , called WorkSheet : public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.