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

Class and/or syntax to support data records and web_ui #8000

Closed
pwbecker opened this issue Jan 21, 2013 · 1 comment
Closed

Class and/or syntax to support data records and web_ui #8000

pwbecker opened this issue Jan 21, 2013 · 1 comment

Comments

@pwbecker
Copy link

Coding data records is tedious if strong typing and string versions of each field are required for web_ui binding. See http://stackoverflow.com/questions/14427600/dart-best-practice-to-deal-with-data-records

The following would be one approach:
    class Item extends DataRecord {
      int itemid = 0,
      String itemName = 'New item',
      double score = 0.0;
    }
Then, without further coding, to be able to write

    item.toStrings(); // Perhaps to/from unnecessary...
    ...
    item.fromStrings(); // ... if strings version synced automagically?
    ...
    item.fromJson(json);
    ...
    item.setDefaults(); // results in {0,'New item',0.0}
And to be able to write in the HTML:

    value="{{item.strings.score}}"

A simpler alternative might be to allow value="{{}}" bindings to non-string types.

@sethladd
Copy link
Contributor

Moved over to https://github.com/dart-lang/web-ui/issues/317


Added MovedToGithub label.

This issue was closed.
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

No branches or pull requests

2 participants