Skip to content
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';
}
}
}