forked from loafle/openapi-generator-original
Dart - generate constructor with named params (#6751)
* Dart - generate constructor with names params * Test if constructor exists
This commit is contained in:
parent
1f277002a1
commit
1798fea3e7
@ -6,7 +6,12 @@ class {{classname}} {
|
||||
{{#min}} // range from {{min}} to {{max}}{{/min}}//{{^min}}enum {{name}}Enum { {{#values}} {{.}}, {{/values}} };{{/min}}{
|
||||
{{/allowableValues}}
|
||||
{{/vars}}
|
||||
{{classname}}();
|
||||
|
||||
{{classname}}({
|
||||
{{#vars}}
|
||||
this.{{name}},
|
||||
{{/vars}}
|
||||
});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
|
@ -25,11 +25,12 @@ void main() {
|
||||
..id = 124321
|
||||
..name = 'Jose'
|
||||
];
|
||||
return Pet()
|
||||
..id = id
|
||||
..category = category
|
||||
..tags = tags
|
||||
..name = name
|
||||
return Pet(
|
||||
id : id,
|
||||
category: category,
|
||||
tags: tags,
|
||||
name: name,
|
||||
)
|
||||
..status = status
|
||||
..photoUrls = ['https://petstore.com/sample/photo1.jpg'];
|
||||
}
|
||||
|
@ -7,7 +7,12 @@ class ApiResponse {
|
||||
String type = null;
|
||||
|
||||
String message = null;
|
||||
ApiResponse();
|
||||
|
||||
ApiResponse({
|
||||
this.code,
|
||||
this.type,
|
||||
this.message,
|
||||
});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
|
@ -5,7 +5,11 @@ class Category {
|
||||
int id = null;
|
||||
|
||||
String name = null;
|
||||
Category();
|
||||
|
||||
Category({
|
||||
this.id,
|
||||
this.name,
|
||||
});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
|
@ -14,7 +14,15 @@ class Order {
|
||||
//enum statusEnum { placed, approved, delivered, };{
|
||||
|
||||
bool complete = false;
|
||||
Order();
|
||||
|
||||
Order({
|
||||
this.id,
|
||||
this.petId,
|
||||
this.quantity,
|
||||
this.shipDate,
|
||||
this.status,
|
||||
this.complete,
|
||||
});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
|
@ -14,7 +14,15 @@ class Pet {
|
||||
/* pet status in the store */
|
||||
String status = null;
|
||||
//enum statusEnum { available, pending, sold, };{
|
||||
Pet();
|
||||
|
||||
Pet({
|
||||
this.id,
|
||||
this.category,
|
||||
this.name,
|
||||
this.photoUrls,
|
||||
this.tags,
|
||||
this.status,
|
||||
});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
|
@ -5,7 +5,11 @@ class Tag {
|
||||
int id = null;
|
||||
|
||||
String name = null;
|
||||
Tag();
|
||||
|
||||
Tag({
|
||||
this.id,
|
||||
this.name,
|
||||
});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
|
@ -17,7 +17,17 @@ class User {
|
||||
String phone = null;
|
||||
/* User Status */
|
||||
int userStatus = null;
|
||||
User();
|
||||
|
||||
User({
|
||||
this.id,
|
||||
this.username,
|
||||
this.firstName,
|
||||
this.lastName,
|
||||
this.email,
|
||||
this.password,
|
||||
this.phone,
|
||||
this.userStatus,
|
||||
});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user