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
Dart ServiceStack Reference supports **all Dart platforms**, including Flutter and AngularDart or Dart Web Apps with and without Dart 2's Strong Mode - in the same optimal development workflow pioneered in [Add ServiceStack Reference](http://docs.servicestack.net/add-servicestack-reference) where it doesn't requiring any additional tooling, transformers or build steps.
8
8
9
9
Due to the lack of reflection and Mirror support, consuming JSON APIs can be quite [cumbersome in Flutter](https://flutter.io/cookbook/networking/fetch-data/). But we've been able to achieve the same productive development experience available in [all supported languages](http://docs.servicestack.net/add-servicestack-reference) where you can use the generated Dart DTOs from any remote v5.1+ ServiceStack endpoint with ServiceStack's Smart generic
10
-
[JsonServiceClient](https://pub.dartlang.org/documentation/servicestack/0.0.7/client/JsonServiceClient-class.html) available in the [servicestack Dart package](https://pub.dartlang.org/packages/servicestack#-installing-tab-), to enable an end-to-end Typed API for calling Services by [sending and receiving native DTOs](http://docs.servicestack.net/architecture-overview#client-architecture).
10
+
[JsonServiceClient](https://pub.dartlang.org/documentation/servicestack/latest/servicestack/JsonServiceClient-class.html) available in the [servicestack Dart package](https://pub.dartlang.org/packages/servicestack#-installing-tab-), to enable an end-to-end Typed API for calling Services by [sending and receiving native DTOs](http://docs.servicestack.net/architecture-overview#client-architecture).
11
11
12
12
### Example Usage
13
13
@@ -29,15 +29,15 @@ To make API calls we need to use the `JsonServiceClient`, installed by adding th
29
29
30
30
```yaml
31
31
dependencies:
32
-
servicestack: "^0.0.9"
32
+
servicestack: "^1.0.0"
33
33
```
34
34
35
35
Saving `pubspec.yaml` in VS Code with the [Dart Code Extension](https://dartcode.org) automatically calls `flutter packages get` to add any new dependencies to your project.
36
36
37
37
We now have everything we need to be able to make typed API requests to any of [TechStacks APIs](https://www.techstacks.io/metadata) with a shared `JsonServiceClient` instance populated with the base URL of the remote endpoint, e.g:
38
38
39
39
```dart
40
-
import 'package:servicestack/client.dart';
40
+
import 'package:servicestack/servicestack.dart';
41
41
42
42
import 'techstacks.dtos.dart';
43
43
@@ -100,7 +100,7 @@ abstract class IConvertible
100
100
}
101
101
```
102
102
103
-
The conversion logic that handles the behind-the-scenes conversion into and out of Dart Types is maintained in the extensible [JsonConverters](https://pub.dartlang.org/documentation/servicestack/0.0.7/client/JsonConverters/Converters.html) class which lets you replace built-in converters with your own implementation or register new Converters when you want to take over handling of specific types.
103
+
The conversion logic that handles the behind-the-scenes conversion into and out of Dart Types is maintained in the extensible [JsonConverters](https://pub.dartlang.org/documentation/servicestack/latest/servicestack/JsonConverters/Converters.html) class which lets you replace built-in converters with your own implementation or register new Converters when you want to take over handling of specific types.
104
104
105
105
### JsonServiceClient
106
106
@@ -120,11 +120,11 @@ Behind the scenes `JsonServiceClient` leverages the optimal [`HttpClient` in dar
120
120
121
121
The `servicestack` Dart package also includes an alternative `JsonWebClient` implementation which instead performs HTTP Requests using [dart:html BrowserClient](https://webdev.dartlang.org/angular/guide/server-communication) to use the browsers built-in `XMLHttpRequest` object. Despite their implementation differences `JsonWebClient` also supports the same feature-set as the Dart VM's `JsonServiceClient` above.
122
122
123
-
AngularDart or Dart Web Apps can use `JsonWebClient` by importing `web_client.dart`, e.g:
123
+
AngularDart or Dart Web Apps can use `JsonWebClient` by importing `web.dart`, e.g:
124
124
125
125
```dart
126
-
import 'package:servicestack/client.dart';
127
-
import 'package:servicestack/web_client.dart';
126
+
import 'package:servicestack/servicestack.dart';
127
+
import 'package:servicestack/web.dart';
128
128
129
129
var client = new JsonWebClient("https://www.techstacks.io");
130
130
```
@@ -197,7 +197,7 @@ Then to use `JsonServiceClient` add the `servicestack` dependency to your apps [
197
197
dependencies:
198
198
flutter:
199
199
sdk: flutter
200
-
servicestack: "^0.0.9"
200
+
servicestack: "^1.0.0"
201
201
202
202
Saving `pubspec.yaml` automatically runs [flutter packages get](https://flutter.io/using-packages/) to install any new dependencies in your App.
203
203
@@ -221,12 +221,12 @@ Which updates all Dart references in the current directory, including any custom
221
221
Updated: test.dtos.dart
222
222
Updated: techstacks.dtos.dart
223
223
224
-
This gives us everything we need to call Web Services in our Flutter App, by importing `package:servicestack/client.dart` containing `JsonServiceClient` as well as any generated DTOs.
224
+
This gives us everything we need to call Web Services in our Flutter App, by importing `package:servicestack/servicestack.dart` containing `JsonServiceClient` as well as any generated DTOs.
225
225
226
226
Then create new `JsonServiceClient` instances initialized with the `BaseUrl` for each of the remote endpoints we want to call:
227
227
228
228
```dart
229
-
import 'package:servicestack/client.dart';
229
+
import 'package:servicestack/servicestack.dart';
230
230
231
231
import 'test.dtos.dart';
232
232
import 'techstacks.dtos.dart';
@@ -484,10 +484,10 @@ To display the image we assign the response to the `imageBytes` field within the
484
484
485
485
The [HelloAngularDart](https://github.com/ServiceStackApps/HelloAngularDart) project demonstrates the same functionality in an AngularDart Web App running inside a Web Browser.
486
486
487
-
The only difference is having to also import `web_client.dart` containing the `JsonWebClient`:
487
+
The only difference is having to also import `web.dart` containing the `JsonWebClient`:
488
488
489
489
```dart
490
-
import 'package:servicestack/web_client.dart';
490
+
import 'package:servicestack/web.dart';
491
491
```
492
492
493
493
and changing the clients to use the `JsonWebClient` instead, e.g:
0 commit comments