add flutter web support on jaguar dart (#3786)

This commit is contained in:
Jaumard 2019-08-29 04:30:09 +02:00 committed by William Cheng
parent 44d8b49dee
commit c2f786b8ad
5 changed files with 10 additions and 10 deletions

View File

@ -1,6 +1,6 @@
library {{pubName}}.api; library {{pubName}}.api;
import 'package:http/io_client.dart'; import 'package:http/http.dart' as http;
import 'package:jaguar_serializer/jaguar_serializer.dart'; import 'package:jaguar_serializer/jaguar_serializer.dart';
{{#protoFormat}} {{#protoFormat}}
import 'package:jaguar_serializer_protobuf/proto_repo.dart'; import 'package:jaguar_serializer_protobuf/proto_repo.dart';
@ -52,7 +52,7 @@ class {{clientName}} {
* Add custom global interceptors, put overrideInterceptors to true to set your interceptors only (auth interceptors will not be added) * Add custom global interceptors, put overrideInterceptors to true to set your interceptors only (auth interceptors will not be added)
*/ */
{{clientName}}({List<Interceptor> interceptors, bool overrideInterceptors = false, String baseUrl, this.timeout = const Duration(minutes: 2)}) { {{clientName}}({List<Interceptor> interceptors, bool overrideInterceptors = false, String baseUrl, this.timeout = const Duration(minutes: 2)}) {
_baseRoute = Route(baseUrl ?? basePath).withClient(globalClient ?? IOClient()); _baseRoute = Route(baseUrl ?? basePath).withClient(globalClient ?? http.Client());
if(interceptors == null) { if(interceptors == null) {
this.interceptors = _defaultInterceptors; this.interceptors = _defaultInterceptors;
} }

View File

@ -1,6 +1,6 @@
library openapi.api; library openapi.api;
import 'package:http/io_client.dart'; import 'package:http/http.dart' as http;
import 'package:jaguar_serializer/jaguar_serializer.dart'; import 'package:jaguar_serializer/jaguar_serializer.dart';
import 'package:jaguar_retrofit/jaguar_retrofit.dart'; import 'package:jaguar_retrofit/jaguar_retrofit.dart';
import 'package:openapi/auth/api_key_auth.dart'; import 'package:openapi/auth/api_key_auth.dart';
@ -47,7 +47,7 @@ class Openapi {
* Add custom global interceptors, put overrideInterceptors to true to set your interceptors only (auth interceptors will not be added) * Add custom global interceptors, put overrideInterceptors to true to set your interceptors only (auth interceptors will not be added)
*/ */
Openapi({List<Interceptor> interceptors, bool overrideInterceptors = false, String baseUrl, this.timeout = const Duration(minutes: 2)}) { Openapi({List<Interceptor> interceptors, bool overrideInterceptors = false, String baseUrl, this.timeout = const Duration(minutes: 2)}) {
_baseRoute = Route(baseUrl ?? basePath).withClient(globalClient ?? IOClient()); _baseRoute = Route(baseUrl ?? basePath).withClient(globalClient ?? http.Client());
if(interceptors == null) { if(interceptors == null) {
this.interceptors = _defaultInterceptors; this.interceptors = _defaultInterceptors;
} }

View File

@ -1,6 +1,6 @@
library openapi.api; library openapi.api;
import 'package:http/io_client.dart'; import 'package:http/http.dart' as http;
import 'package:jaguar_serializer/jaguar_serializer.dart'; import 'package:jaguar_serializer/jaguar_serializer.dart';
import 'package:jaguar_serializer_protobuf/proto_repo.dart'; import 'package:jaguar_serializer_protobuf/proto_repo.dart';
import 'package:jaguar_retrofit/jaguar_retrofit.dart'; import 'package:jaguar_retrofit/jaguar_retrofit.dart';
@ -57,7 +57,7 @@ class Openapi {
* Add custom global interceptors, put overrideInterceptors to true to set your interceptors only (auth interceptors will not be added) * Add custom global interceptors, put overrideInterceptors to true to set your interceptors only (auth interceptors will not be added)
*/ */
Openapi({List<Interceptor> interceptors, bool overrideInterceptors = false, String baseUrl, this.timeout = const Duration(minutes: 2)}) { Openapi({List<Interceptor> interceptors, bool overrideInterceptors = false, String baseUrl, this.timeout = const Duration(minutes: 2)}) {
_baseRoute = Route(baseUrl ?? basePath).withClient(globalClient ?? IOClient()); _baseRoute = Route(baseUrl ?? basePath).withClient(globalClient ?? http.Client());
if(interceptors == null) { if(interceptors == null) {
this.interceptors = _defaultInterceptors; this.interceptors = _defaultInterceptors;
} }

View File

@ -1,6 +1,6 @@
library openapi.api; library openapi.api;
import 'package:http/io_client.dart'; import 'package:http/http.dart' as http;
import 'package:jaguar_serializer/jaguar_serializer.dart'; import 'package:jaguar_serializer/jaguar_serializer.dart';
import 'package:jaguar_retrofit/jaguar_retrofit.dart'; import 'package:jaguar_retrofit/jaguar_retrofit.dart';
import 'package:openapi/auth/api_key_auth.dart'; import 'package:openapi/auth/api_key_auth.dart';
@ -47,7 +47,7 @@ class Openapi {
* Add custom global interceptors, put overrideInterceptors to true to set your interceptors only (auth interceptors will not be added) * Add custom global interceptors, put overrideInterceptors to true to set your interceptors only (auth interceptors will not be added)
*/ */
Openapi({List<Interceptor> interceptors, bool overrideInterceptors = false, String baseUrl, this.timeout = const Duration(minutes: 2)}) { Openapi({List<Interceptor> interceptors, bool overrideInterceptors = false, String baseUrl, this.timeout = const Duration(minutes: 2)}) {
_baseRoute = Route(baseUrl ?? basePath).withClient(globalClient ?? IOClient()); _baseRoute = Route(baseUrl ?? basePath).withClient(globalClient ?? http.Client());
if(interceptors == null) { if(interceptors == null) {
this.interceptors = _defaultInterceptors; this.interceptors = _defaultInterceptors;
} }

View File

@ -1,6 +1,6 @@
library openapi.api; library openapi.api;
import 'package:http/io_client.dart'; import 'package:http/http.dart' as http;
import 'package:jaguar_serializer/jaguar_serializer.dart'; import 'package:jaguar_serializer/jaguar_serializer.dart';
import 'package:jaguar_serializer_protobuf/proto_repo.dart'; import 'package:jaguar_serializer_protobuf/proto_repo.dart';
import 'package:jaguar_retrofit/jaguar_retrofit.dart'; import 'package:jaguar_retrofit/jaguar_retrofit.dart';
@ -57,7 +57,7 @@ class Openapi {
* Add custom global interceptors, put overrideInterceptors to true to set your interceptors only (auth interceptors will not be added) * Add custom global interceptors, put overrideInterceptors to true to set your interceptors only (auth interceptors will not be added)
*/ */
Openapi({List<Interceptor> interceptors, bool overrideInterceptors = false, String baseUrl, this.timeout = const Duration(minutes: 2)}) { Openapi({List<Interceptor> interceptors, bool overrideInterceptors = false, String baseUrl, this.timeout = const Duration(minutes: 2)}) {
_baseRoute = Route(baseUrl ?? basePath).withClient(globalClient ?? IOClient()); _baseRoute = Route(baseUrl ?? basePath).withClient(globalClient ?? http.Client());
if(interceptors == null) { if(interceptors == null) {
this.interceptors = _defaultInterceptors; this.interceptors = _defaultInterceptors;
} }