Skip to content

Commit

Permalink
update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
urusai88 committed Jun 29, 2024
1 parent 9feb591 commit e55788f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
## 1.0.0+2
- update README.md

## 1.0.0+1
- fix code style
- update dependencies

## 1.0.0
- release
- 'package:tio/tio.dart' not does not export dio
- 'package:tio/tio.dart' now exports JsonMap typedef
- rewrite tests
- auth interceptor sync refresh feature

## 0.8.0
- pre-release
- Some refactoring
Expand Down
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ Inspired by [chopper](https://pub.dev/packages/chopper).
#### Basic usage:

```dart
import 'package:tio/tio.dart'; // 'package:dio.dio.dart' imports implicitly.
// ignore_for_file: avoid_print
import 'package:dio/dio.dart';
import 'package:tio/tio.dart';
class User {
User.fromJson(Map<String, dynamic> json) : id = json['id'] as int;
Expand All @@ -31,7 +33,8 @@ class MyError {
const MyError.empty() : errorMessage = 'Unknown message';
MyError.fromJson(Map<String, dynamic> json) : errorMessage = json['message'] as String;
MyError.fromJson(Map<String, dynamic> json)
: errorMessage = json['message'] as String;
final String errorMessage;
}
Expand All @@ -58,6 +61,15 @@ final tio = Tio<MyError>(
Future<TioResponse<User, MyError>> getUser(int id) =>
tio.get<User>('/users/$id').one();
Future<TioResponse<List<User>, MyError>> getUsers() =>
tio.get<User>('/users').many();
Future<TioResponse<User, MyError>> updateUser(int id, String name) =>
tio.post<User>('/users/$id', data: {'name': name}).one();
Future<TioResponse<String, MyError>> geString() =>
tio.get<String>('/text').string();
void main() async {
switch (await getUser(1)) {
case TioSuccess<User, MyError>(result: final user):
Expand All @@ -66,7 +78,6 @@ void main() async {
print('error acquired ${error.errorMessage}');
}
}
```

## Guide
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: tio
version: 1.0.0+1
version: 1.0.0+2
repository: https://github.com/urusai88/tio

description: |
Expand Down

0 comments on commit e55788f

Please sign in to comment.