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

Update role.dart #146

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions lib/role.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,23 @@ part of appwrite;
class Role {
Role._();

static String any() {
return 'any';
}

static String user(String id, [String status = '']) {
static String any() => 'any';
String status='';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't really make sense to add this as a instance attribute since you never instantiate a Role object..

static String user(String id, status]) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to do this because this makes status required.

if(status.isEmpty) {
return 'user:$id';
}
return 'user:$id/$status';
}

static String users([String status = '']) {
static String users(status]) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, status shouldn't be required. In addition, there's an extra bracket here and missing type.

if(status.isEmpty) {
return 'users';
}
return 'users/$status';
}

static String guests() {
return 'guests';
}
static String guests() => 'guests';

static String team(String id, [String role = '']) {
if(role.isEmpty) {
Expand All @@ -35,4 +31,4 @@ class Role {
static String member(String id) {
return 'member:$id';
}
}
}