Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Merge requests
  • !3608

[Dart] Make clients crossplatform

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/nickmeinhold/make-dart-clients-crossplatform into master 5 years ago
  • Overview 0
  • Commits 2
  • Pipelines 0
  • Changes 15

Created by: nickmeinhold

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh, ./bin/openapi3/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\. If contributing template-only or documentation-only changes which will change sample output, be sure to build the project first.
  • Filed the PR against the correct branch: master, 4.1.x, 5.0.x. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.
    • @ircecho @swipesight @jaumard

Description of the PR

Since 12.0 the http package has had conditional imports so creating a Client() will use the appropriate option of either a BrowserClient or an IOClient depending on the platform so there would seem to be no need for the generator to use a browserClient flag to distinguish between Flutter and the web.

I didn't create an issue as there was already #3540 (closed) (although it's been closed so I wasn't sure what I should do).

Compare
  • master (base)

and
  • latest version
    82ac454c
    2 commits, 2 years ago

15 files
+ 15
- 22

    Preferences

    File browser
    Compare changes
modules/openapi-ge‎nerator/…/…/…/dart2‎
api_clien‎t.mustache‎ +1 -1
apilib.‎mustache‎ +1 -2
pubspec.‎mustache‎ +1 -1
samples/cli‎ent/petstore‎
dart/flutter_p‎etstore/openapi‎
.openapi-‎generator‎
VER‎SION‎ +1 -1
do‎cs‎
PetA‎pi.md‎ +2 -4
lib‎/api‎
pet_ap‎i.dart‎ +1 -4
pubspe‎c.yaml‎ +1 -1
da‎rt2‎
flutter_pets‎tore/openapi‎
.openapi-‎generator‎
VER‎SION‎ +1 -1
pubspe‎c.yaml‎ +1 -1
ope‎napi‎
.openapi-‎generator‎
VER‎SION‎ +1 -1
pubspe‎c.yaml‎ +1 -1
openapi-bro‎wser-client‎
.openapi-‎generator‎
VER‎SION‎ +1 -1
l‎ib‎
api.‎dart‎ +0 -1
api_cli‎ent.dart‎ +1 -1
pubspe‎c.yaml‎ +1 -1
modules/openapi-generator/src/main/resources/dart2/api_client.mustache
+ 1
- 1
  • View file @ 82ac454c

  • Edit in single-file editor

  • Open in Web IDE


@@ -10,7 +10,7 @@ class QueryParam {
class ApiClient {
String basePath;
var client = {{#browserClient}}Browser{{/browserClient}}Client();
var client = Client();
Map<String, String> _defaultHeaderMap = {};
Map<String, Authentication> _authentications = {};
modules/openapi-generator/src/main/resources/dart2/apilib.mustache
+ 1
- 2
  • View file @ 82ac454c

  • Edit in single-file editor

  • Open in Web IDE


library {{pubName}}.api;
import 'dart:async';
import 'dart:convert';{{#browserClient}}
import 'package:http/browser_client.dart';{{/browserClient}}
import 'dart:convert';
import 'package:http/http.dart';
part 'api_client.dart';
modules/openapi-generator/src/main/resources/dart2/pubspec.mustache
+ 1
- 1
  • View file @ 82ac454c

  • Edit in single-file editor

  • Open in Web IDE


@@ -4,6 +4,6 @@ description: {{pubDescription}}
environment:
sdk: '>=2.0.0 <3.0.0'
dependencies:
http: '>=0.11.1 <0.13.0'
http: '>=0.12.0 <0.13.0'
dev_dependencies:
test: ^1.3.0
samples/client/petstore/dart/flutter_petstore/openapi/.openapi-generator/VERSION
+ 1
- 1
  • View file @ 82ac454c

  • Edit in single-file editor

  • Open in Web IDE

4.1.0-SNAPSHOT
\ No newline at end of file
4.1.1-SNAPSHOT
\ No newline at end of file
samples/client/petstore/dart/flutter_petstore/openapi/docs/PetApi.md
+ 2
- 4
  • View file @ 82ac454c

  • Edit in single-file editor

  • Open in Web IDE


@@ -151,7 +151,7 @@ Name | Type | Description | Notes
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **findPetsByTags**
> List<Pet> findPetsByTags(tags, maxCount)
> List<Pet> findPetsByTags(tags)
Finds Pets by tags
@@ -165,10 +165,9 @@ import 'package:openapi/api.dart';
var api_instance = PetApi();
var tags = []; // List<String> | Tags to filter by
var maxCount = 56; // int | Maximum number of items to return
try {
var result = api_instance.findPetsByTags(tags, maxCount);
var result = api_instance.findPetsByTags(tags);
print(result);
} catch (e) {
print("Exception when calling PetApi->findPetsByTags: $e\n");
@@ -180,7 +179,6 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**tags** | [**List&lt;String&gt;**](String.md)| Tags to filter by | [default to []]
**maxCount** | **int**| Maximum number of items to return | [optional] [default to null]
### Return type
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
2
.NET dependencies
2
.NET dependencies
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
0
0 participants
Reference: OpenAPITools/openapi-generator!14216
Source branch: github/fork/nickmeinhold/make-dart-clients-crossplatform

Menu

Explore Projects Groups Snippets