Skip to content

Commit 5aa66ef

Browse files
committed
add smaple code
1 parent 56cdc67 commit 5aa66ef

File tree

3 files changed

+29
-13
lines changed

3 files changed

+29
-13
lines changed

example/lib/example.dart

+6-3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ abstract class RestClient {
1313
factory RestClient(Dio dio, {String baseUrl}) = _RestClient;
1414

1515
@GET("/tags")
16-
Future<List<String>> getTags();
16+
Future<List<String>> getTags(
17+
{@Header("optionalHeader") String optionalHeader});
1718

19+
@GET("https://httpbin.org/status/204")
20+
Future<HttpResponse<void>> reponseWith204();
1821
@GET("/tags")
1922
Stream<List<String>> getTagsAsStream();
2023

@@ -87,13 +90,13 @@ abstract class RestClient {
8790
Future<String> postFormData3(
8891
{@Part(value: "customfiles", contentType: 'application/json')
8992
List<File> files,
90-
@Part()
93+
@Part(fileName: "abc.txt")
9194
File file});
9295

9396
@POST("/post")
9497
Future<String> postFormData6(
9598
{@Part(value: "customfiles") List<List<int>> files,
96-
@Part() List<int> file});
99+
@Part(fileName: "abc.txt") List<int> file});
97100

98101
@POST("/post")
99102
Future<String> postFormData4(@Part() List<Task> tasks, @Part() File file);

example/lib/example.g.dart

+22-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ dev_dependencies:
1515
test:
1616
retrofit_generator:
1717
build_runner: ^1.4.0
18-
json_serializable: any
18+
json_serializable: ^3.5.1
1919
mock_web_server:
2020

2121
dependency_overrides:

0 commit comments

Comments
 (0)