Skip to content

Commit 575b5e5

Browse files
committed
update examples
1 parent 9c8b2f7 commit 575b5e5

File tree

159 files changed

+7983
-7772
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+7983
-7772
lines changed

docs/examples/avatars/get-screenshot.md

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,27 @@ Avatars avatars = Avatars(client);
99
// Downloading file
1010
Uint8List bytes = await avatars.getScreenshot(
1111
url: 'https://example.com',
12-
headers: {}, // optional
13-
viewportWidth: 1, // optional
14-
viewportHeight: 1, // optional
15-
scale: 0.1, // optional
12+
headers: {
13+
"Authorization": "Bearer token123",
14+
"X-Custom-Header": "value"
15+
}, // optional
16+
viewportWidth: 1920, // optional
17+
viewportHeight: 1080, // optional
18+
scale: 2, // optional
1619
theme: Theme.light, // optional
17-
userAgent: '<USER_AGENT>', // optional
18-
fullpage: false, // optional
19-
locale: '<LOCALE>', // optional
20+
userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15', // optional
21+
fullpage: true, // optional
22+
locale: 'en-US', // optional
2023
timezone: Timezone.africaAbidjan, // optional
21-
latitude: -90, // optional
22-
longitude: -180, // optional
23-
accuracy: 0, // optional
24-
touch: false, // optional
25-
permissions: [], // optional
26-
sleep: 0, // optional
27-
width: 0, // optional
28-
height: 0, // optional
29-
quality: -1, // optional
24+
latitude: 37.7749, // optional
25+
longitude: -122.4194, // optional
26+
accuracy: 100, // optional
27+
touch: true, // optional
28+
permissions: ["geolocation","notifications"], // optional
29+
sleep: 3, // optional
30+
width: 800, // optional
31+
height: 600, // optional
32+
quality: 85, // optional
3033
output: Output.jpg, // optional
3134
)
3235

@@ -37,24 +40,27 @@ file.writeAsBytesSync(bytes);
3740
FutureBuilder(
3841
future: avatars.getScreenshot(
3942
url:'https://example.com' ,
40-
headers:{} , // optional
41-
viewportWidth:1 , // optional
42-
viewportHeight:1 , // optional
43-
scale:0.1 , // optional
43+
headers:{
44+
"Authorization": "Bearer token123",
45+
"X-Custom-Header": "value"
46+
} , // optional
47+
viewportWidth:1920 , // optional
48+
viewportHeight:1080 , // optional
49+
scale:2 , // optional
4450
theme: Theme.light, // optional
45-
userAgent:'<USER_AGENT>' , // optional
46-
fullpage:false , // optional
47-
locale:'<LOCALE>' , // optional
51+
userAgent:'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15' , // optional
52+
fullpage:true , // optional
53+
locale:'en-US' , // optional
4854
timezone: Timezone.africaAbidjan, // optional
49-
latitude:-90 , // optional
50-
longitude:-180 , // optional
51-
accuracy:0 , // optional
52-
touch:false , // optional
53-
permissions:[] , // optional
54-
sleep:0 , // optional
55-
width:0 , // optional
56-
height:0 , // optional
57-
quality:-1 , // optional
55+
latitude:37.7749 , // optional
56+
longitude:-122.4194 , // optional
57+
accuracy:100 , // optional
58+
touch:true , // optional
59+
permissions:["geolocation","notifications"] , // optional
60+
sleep:3 , // optional
61+
width:800 , // optional
62+
height:600 , // optional
63+
quality:85 , // optional
5864
output: Output.jpg, // optional
5965
), // Works for both public file and private file, for private files you need to be logged in
6066
builder: (context, snapshot) {

lib/appwrite.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// Appwrite Flutter SDK
22
///
3-
/// This SDK is compatible with Appwrite server version 1.8.x.
3+
/// This SDK is compatible with Appwrite server version 1.8.x.
44
/// For older versions, please check
55
/// [previous releases](https://github.com/appwrite/sdk-for-flutter/releases).
66
library appwrite;

lib/client_browser.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export 'src/client_browser.dart';
1+
export 'src/client_browser.dart';

lib/client_io.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export 'src/client_io.dart';
1+
export 'src/client_io.dart';

lib/operator.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Operator {
3131

3232
result['method'] = method;
3333

34-
if (values != null) {
34+
if(values != null) {
3535
result['values'] = values is List ? values : [values];
3636
}
3737

@@ -147,7 +147,8 @@ class Operator {
147147
Operator._('arrayRemove', [value]).toString();
148148

149149
/// Remove duplicate values from an array attribute.
150-
static String arrayUnique() => Operator._('arrayUnique', []).toString();
150+
static String arrayUnique() =>
151+
Operator._('arrayUnique', []).toString();
151152

152153
/// Keep only values that exist in both the current array and the provided array.
153154
static String arrayIntersect(List<dynamic> values) =>
@@ -172,7 +173,8 @@ class Operator {
172173
Operator._('stringReplace', [search, replace]).toString();
173174

174175
/// Toggle a boolean attribute.
175-
static String toggle() => Operator._('toggle', []).toString();
176+
static String toggle() =>
177+
Operator._('toggle', []).toString();
176178

177179
/// Add days to a date attribute.
178180
static String dateAddDays(int days) =>
@@ -183,5 +185,6 @@ class Operator {
183185
Operator._('dateSubDays', [days]).toString();
184186

185187
/// Set a date attribute to the current date and time.
186-
static String dateSetNow() => Operator._('dateSetNow', []).toString();
188+
static String dateSetNow() =>
189+
Operator._('dateSetNow', []).toString();
187190
}

lib/query.dart

Lines changed: 36 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ class Query {
1010

1111
Map<String, dynamic> toJson() {
1212
final result = <String, dynamic>{};
13-
13+
1414
result['method'] = method;
15-
16-
if (attribute != null) {
15+
16+
if(attribute != null) {
1717
result['attribute'] = attribute;
1818
}
19-
20-
if (values != null) {
19+
20+
if(values != null) {
2121
result['values'] = values is List ? values : [values];
2222
}
2323

@@ -28,7 +28,7 @@ class Query {
2828
String toString() => jsonEncode(toJson());
2929

3030
/// Filter resources where [attribute] is equal to [value].
31-
///
31+
///
3232
/// [value] can be a single value or a list. If a list is used
3333
/// the query will return resources where [attribute] is equal
3434
/// to any of the values in the list.
@@ -106,36 +106,40 @@ class Query {
106106
Query._('notEndsWith', attribute, value).toString();
107107

108108
/// Filter resources where document was created before [value].
109-
static String createdBefore(String value) => lessThan('\$createdAt', value);
109+
static String createdBefore(String value) =>
110+
lessThan('\$createdAt', value);
110111

111112
/// Filter resources where document was created after [value].
112-
static String createdAfter(String value) => greaterThan('\$createdAt', value);
113+
static String createdAfter(String value) =>
114+
greaterThan('\$createdAt', value);
113115

114116
/// Filter resources where document was created between [start] and [end] (inclusive).
115117
static String createdBetween(String start, String end) =>
116118
between('\$createdAt', start, end);
117119

118120
/// Filter resources where document was updated before [value].
119-
static String updatedBefore(String value) => lessThan('\$updatedAt', value);
121+
static String updatedBefore(String value) =>
122+
lessThan('\$updatedAt', value);
120123

121124
/// Filter resources where document was updated after [value].
122-
static String updatedAfter(String value) => greaterThan('\$updatedAt', value);
125+
static String updatedAfter(String value) =>
126+
greaterThan('\$updatedAt', value);
123127

124128
/// Filter resources where document was updated between [start] and [end] (inclusive).
125129
static String updatedBetween(String start, String end) =>
126130
between('\$updatedAt', start, end);
127131

128132
static String or(List<String> queries) => Query._(
129-
'or',
130-
null,
131-
queries.map((query) => jsonDecode(query)).toList(),
132-
).toString();
133+
'or',
134+
null,
135+
queries.map((query) => jsonDecode(query)).toList(),
136+
).toString();
133137

134138
static String and(List<String> queries) => Query._(
135-
'and',
136-
null,
137-
queries.map((query) => jsonDecode(query)).toList(),
138-
).toString();
139+
'and',
140+
null,
141+
queries.map((query) => jsonDecode(query)).toList(),
142+
).toString();
139143

140144
/// Specify which attributes should be returned by the API call.
141145
static String select(List<String> attributes) =>
@@ -150,17 +154,18 @@ class Query {
150154
Query._('orderDesc', attribute).toString();
151155

152156
/// Sort results randomly.
153-
static String orderRandom() => Query._('orderRandom').toString();
157+
static String orderRandom() =>
158+
Query._('orderRandom').toString();
154159

155160
/// Return results before [id].
156-
///
161+
///
157162
/// Refer to the [Cursor Based Pagination](https://appwrite.io/docs/pagination#cursor-pagination)
158163
/// docs for more information.
159164
static String cursorBefore(String id) =>
160165
Query._('cursorBefore', null, id).toString();
161166

162167
/// Return results after [id].
163-
///
168+
///
164169
/// Refer to the [Cursor Based Pagination](https://appwrite.io/docs/pagination#cursor-pagination)
165170
/// docs for more information.
166171
static String cursorAfter(String id) =>
@@ -170,43 +175,27 @@ class Query {
170175
static String limit(int limit) => Query._('limit', null, limit).toString();
171176

172177
/// Return results from [offset].
173-
///
178+
///
174179
/// Refer to the [Offset Pagination](https://appwrite.io/docs/pagination#offset-pagination)
175180
/// docs for more information.
176181
static String offset(int offset) =>
177182
Query._('offset', null, offset).toString();
178183

179184
/// Filter resources where [attribute] is at a specific distance from the given coordinates.
180-
static String distanceEqual(
181-
String attribute, List<dynamic> values, num distance,
182-
[bool meters = true]) =>
183-
Query._('distanceEqual', attribute, [
184-
[values, distance, meters]
185-
]).toString();
185+
static String distanceEqual(String attribute, List<dynamic> values, num distance, [bool meters = true]) =>
186+
Query._('distanceEqual', attribute, [[values, distance, meters]]).toString();
186187

187188
/// Filter resources where [attribute] is not at a specific distance from the given coordinates.
188-
static String distanceNotEqual(
189-
String attribute, List<dynamic> values, num distance,
190-
[bool meters = true]) =>
191-
Query._('distanceNotEqual', attribute, [
192-
[values, distance, meters]
193-
]).toString();
189+
static String distanceNotEqual(String attribute, List<dynamic> values, num distance, [bool meters = true]) =>
190+
Query._('distanceNotEqual', attribute, [[values, distance, meters]]).toString();
194191

195192
/// Filter resources where [attribute] is at a distance greater than the specified value from the given coordinates.
196-
static String distanceGreaterThan(
197-
String attribute, List<dynamic> values, num distance,
198-
[bool meters = true]) =>
199-
Query._('distanceGreaterThan', attribute, [
200-
[values, distance, meters]
201-
]).toString();
193+
static String distanceGreaterThan(String attribute, List<dynamic> values, num distance, [bool meters = true]) =>
194+
Query._('distanceGreaterThan', attribute, [[values, distance, meters]]).toString();
202195

203196
/// Filter resources where [attribute] is at a distance less than the specified value from the given coordinates.
204-
static String distanceLessThan(
205-
String attribute, List<dynamic> values, num distance,
206-
[bool meters = true]) =>
207-
Query._('distanceLessThan', attribute, [
208-
[values, distance, meters]
209-
]).toString();
197+
static String distanceLessThan(String attribute, List<dynamic> values, num distance, [bool meters = true]) =>
198+
Query._('distanceLessThan', attribute, [[values, distance, meters]]).toString();
210199

211200
/// Filter resources where [attribute] intersects with the given geometry.
212201
static String intersects(String attribute, List<dynamic> values) =>
@@ -239,4 +228,4 @@ class Query {
239228
/// Filter resources where [attribute] does not touch the given geometry.
240229
static String notTouches(String attribute, List<dynamic> values) =>
241230
Query._('notTouches', attribute, [values]).toString();
242-
}
231+
}

lib/realtime_browser.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export 'src/realtime_browser.dart';
1+
export 'src/realtime_browser.dart';

lib/realtime_io.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export 'src/realtime_io.dart';
1+
export 'src/realtime_io.dart';

lib/role.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@ class Role {
6363
static String label(String name) {
6464
return 'label:$name';
6565
}
66-
}
66+
}

0 commit comments

Comments
 (0)