[DART] Add null-safety for dart 2.12+
Created by: harsimranmaan
Is your feature request related to a problem? Please describe.
Starting with DART 2.12 dart packages support sound null-safety making it easy to detect common pitfalls during static analysis.
The current implementation of DART2 does not follow null-safety principles.
Describe the solution you'd like
The generated code should follow sound null-safety as per https://dart.dev/null-safety.
If an openapi field is not marked as required, it should be nullable by default: eg:
Customer:
type: object
required:
- name
- tenant_id
properties:
id:
type: string
format: uuid
readOnly: true
created_at:
type: string
format: date-time
readOnly: true
updated_at:
type: string
format: date-time
readOnly: true
created_by:
type: string
format: uuid
readOnly: true
tenant_id:
type: string
format: uuid
name:
type: string
minLength: 3
maxLength: 50
should generate a class Customer
with fields like
String? id, String tenantId, String name, Datetime? createdAt
...
Describe alternatives you've considered
Use the legacy mode until null-safety is supported.
Additional context
Required by https://github.com/gibahjoe/openapi-generator-dart/issues/26