@pd4d10 I could use some help. Consider the json output for getting gists.
Files is another json and not a list. I'm having trouble serializing this. The Spinlocklabs github.dart declares it as a list which is wrong and results in an error. I've opened an issue there. This is what I've done for now.
But making fileNamesdynamic is creating problems everywhere and I'm not sure if this is the right way to serialize it. For instance, I am unable to use the ObjectTree widget. I have created another widget file and solved the problem but I think re-using the ObjectTree widget is a better way to go. The error is something to do with fileNames being dynamic. Any help is appreciated. Thanks.
@shreyas1599 commented on GitHub (May 6, 2020):
@pd4d10 I could use some help. Consider the json output for getting [gists](https://api.github.com/users/shreyas1599/gists).
`Files` is another json and not a list. I'm having trouble serializing this. The Spinlocklabs `github.dart` declares it as a list which is wrong and results in an error. I've opened an issue there. This is what I've done for now.
```
class GithubGistsItem {
String id;
String description;
bool public;
Map<String, GistFiles> files;
GithubEventUser owner;
List<dynamic> get fileNames {
var filenames = [];
files.forEach((String key, GistFiles value) {
filenames.add(value);
});
return filenames;
}
DateTime createdAt;
DateTime updatedAt;
GithubGistsItem();
factory GithubGistsItem.fromJson(Map<String, dynamic> json) =>
_$GithubGistsItemFromJson(json);
}
```
But making `fileNames`dynamic is creating problems everywhere and I'm not sure if this is the right way to serialize it. For instance, I am unable to use the `ObjectTree` widget. I have created another widget file and solved the problem but I think re-using the `ObjectTree` widget is a better way to go. The error is something to do with fileNames being dynamic. Any help is appreciated. Thanks.
@shreyas1599 commented on GitHub (May 6, 2020):
`type 'MappedListIterable<dynamic, dynamic>' is not a subtype of type 'Iterable<ObjectTreeItem>'`
This is what I tried to do:
```
return ObjectTree(
items: payload.fileNames.map((v) {
return ObjectTreeItem(
url: '',
type: v.type,
name: v.filename,
downloadUrl: v.rawUrl,
);
}),
);
```
Oh, my mistake. values and entries are getters, not methods.
I used them as getters only. Does it make a difference if it's a getter and not a method for this case?
@shreyas1599 commented on GitHub (May 6, 2020):
> Oh, my mistake. `values` and `entries` are getters, not methods.
I used them as getters only. Does it make a difference if it's a getter and not a method for this case?
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @shreyas1599 on GitHub (Apr 23, 2020).
Add user's gists in the profile section.
@shreyas1599 commented on GitHub (May 6, 2020):
@pd4d10 I could use some help. Consider the json output for getting gists.
Filesis another json and not a list. I'm having trouble serializing this. The Spinlocklabsgithub.dartdeclares it as a list which is wrong and results in an error. I've opened an issue there. This is what I've done for now.But making
fileNamesdynamic is creating problems everywhere and I'm not sure if this is the right way to serialize it. For instance, I am unable to use theObjectTreewidget. I have created another widget file and solved the problem but I think re-using theObjectTreewidget is a better way to go. The error is something to do with fileNames being dynamic. Any help is appreciated. Thanks.@pd4d10 commented on GitHub (May 6, 2020):
What's the error message (or error stack)?
@shreyas1599 commented on GitHub (May 6, 2020):
type 'MappedListIterable<dynamic, dynamic>' is not a subtype of type 'Iterable<ObjectTreeItem>'This is what I tried to do:
@pd4d10 commented on GitHub (May 6, 2020):
How about using
files.values()?@pd4d10 commented on GitHub (May 6, 2020):
Or
files.entries()if you want the key too@shreyas1599 commented on GitHub (May 6, 2020):
Doesn't work. Still getting the same error.
@pd4d10 commented on GitHub (May 6, 2020):
Oh, my mistake.
valuesandentriesare getters, not methods.@pd4d10 commented on GitHub (May 6, 2020):
Perhaps you could submit a WIP pull request so I could help to check it.
@shreyas1599 commented on GitHub (May 6, 2020):
I used them as getters only. Does it make a difference if it's a getter and not a method for this case?