-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Flutter SDK to add offline support
- Loading branch information
1 parent
811bd17
commit 896224c
Showing
19 changed files
with
2,064 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
name: appwrite_example | ||
environment: | ||
sdk: '>=2.17.0 <3.0.0' | ||
sdk: ">=2.17.0 <3.0.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,40 @@ | ||
part of appwrite; | ||
|
||
class ID { | ||
ID._(); | ||
|
||
static String unique() { | ||
return 'unique()'; | ||
} | ||
ID._(); | ||
|
||
// Generate a unique ID based on timestamp | ||
// Recreated from https://www.php.net/manual/en/function.uniqid.php | ||
static String _uniqid() { | ||
final now = DateTime.now(); | ||
final secondsSinceEpoch = (now.millisecondsSinceEpoch / 1000).floor(); | ||
final msecs = now.microsecondsSinceEpoch - secondsSinceEpoch * 1000000; | ||
return secondsSinceEpoch.toRadixString(16) + | ||
msecs.toRadixString(16).padLeft(5, '0'); | ||
} | ||
|
||
// Generate a unique ID with padding to have a longer ID | ||
// Recreated from https://github.com/utopia-php/database/blob/main/src/Database/ID.php#L13 | ||
static String _unique({int padding = 7}) { | ||
String id = _uniqid(); | ||
|
||
if (padding > 0) { | ||
StringBuffer sb = StringBuffer(); | ||
for (var i = 0; i < padding; i++) { | ||
sb.write(Random().nextInt(16).toRadixString(16)); | ||
} | ||
|
||
static String custom(String id) { | ||
return id; | ||
id += sb.toString(); | ||
} | ||
} | ||
|
||
return id; | ||
} | ||
|
||
static String unique() { | ||
return _unique(); | ||
} | ||
|
||
static String custom(String id) { | ||
return id; | ||
} | ||
} |
Oops, something went wrong.