createDataModelResponse method

void createDataModelResponse(
  1. String pathPage,
  2. String pageName,
  3. String apiName,
  4. dynamic response,
)

Implementation

void createDataModelResponse(
  String pathPage,
  String pageName,
  String apiName,
  dynamic response,
) {
  final apiClassName = apiName.pascalCase;
  String classResponse = '''import 'dart:convert';

import 'package:core/core.dart';

''';
  classResponse +=
      getResponseClass(apiClassName, 'Response', '', response, true);

  final path = join(pathPage, 'data', 'models', 'response');
  DirectoryHelper.createDir(path, recursive: true);
  join(path, '${apiName.snakeCase}_response.dart').write(classResponse);

  StatusHelper.generated(join(path, '${apiName.snakeCase}_response.dart'));
}