Browse Source

dynamite, nextcloud: make fromJson a factory instead of a static method

pull/331/head
Nikolas Rimikis 2 years ago
parent
commit
7a9eea8d43
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  1. 11
      packages/dynamite/dynamite/lib/src/openapi_builder.dart
  2. 448
      packages/nextcloud/lib/src/nextcloud.openapi.dart

11
packages/dynamite/dynamite/lib/src/openapi_builder.dart

@ -1276,23 +1276,22 @@ TypeResult resolveObject(
)
..redirect = refer('_\$${state.prefix}$identifier'),
),
])
..methods.addAll([
Method(
Constructor(
(final b) => b
..static = true
..factory = true
..name = 'fromJson'
..lambda = true
..returns = refer('${state.prefix}$identifier')
..requiredParameters.add(
Parameter(
(final b) => b
..name = 'json'
..type = refer('Object'),
..type = refer('Map<String, dynamic>'),
),
)
..body = const Code('jsonSerializers.deserializeWith(serializer, json)!'),
),
])
..methods.addAll([
Method(
(final b) => b
..name = 'toJson'

448
packages/nextcloud/lib/src/nextcloud.openapi.dart

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save