You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: example/example.md
+83-63Lines changed: 83 additions & 63 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,13 +34,17 @@ To integrate your Flutter project with Contentstack, install the pub dependency
34
34
35
35
Add this to your package's pubspec.yaml file:
36
36
37
-
dependencies:
38
-
contentstack: any
37
+
```dart
38
+
dependencies:
39
+
contentstack: any
40
+
```
39
41
40
42
You can install packages from the command line:
41
43
with Flutter:
42
44
43
-
$ flutter pub get
45
+
```dart
46
+
$ flutter pub get
47
+
```
44
48
45
49
### Import package
46
50
@@ -52,92 +56,108 @@ Now in your dart or flutter code, you can use
52
56
53
57
To initialize the SDK, specify application context, stack’s API Key, delivery token, and name of the environment where will publish your content, as shown in the snippet below:
54
58
55
-
import 'package:contentstack/contentstack.dart' as contentstack;
56
-
57
-
final stack = contentstack.Stack("apiKey", "deliveryToken", "environment");
58
-
59
+
```dart
60
+
import 'package:contentstack/contentstack.dart' as contentstack;
61
+
final stack = contentstack.Stack("apiKey", "deliveryToken", "environment");
62
+
```
59
63
## Basic Queries
60
64
61
65
To retrieve a single entry from a content type use the code snippet given below:
62
66
63
67
### Make call to get single entry by entry uid
64
68
65
-
final stack = contentstack.Stack('apiKey', 'deliveryToken', 'environment');
66
-
final entry = stack.contentType('content_type_uid').entry(entryUid: 'entry_uid');
67
-
await entry.fetch().then((response) {
68
-
print(response.toString());
69
-
}).catchError((error) {
70
-
print(error.message.toString());
71
-
});
69
+
```dart
70
+
final stack = contentstack.Stack('apiKey', 'deliveryToken', 'environment');
71
+
final entry = stack.contentType('content_type_uid').entry(entryUid: 'entry_uid');
72
+
await entry.fetch().then((response) {
73
+
print(response.toString());
74
+
}).catchError((error) {
75
+
print(error.message.toString());
76
+
});
77
+
```
72
78
73
79
Or, You can get generic objects as well
74
80
75
-
final stack = contentstack.Stack('apiKey', 'deliveryToken', 'environment');
76
-
final entry = stack.contentType('content_type_uid').entry(entryUid: 'entry_uid');
0 commit comments