createDataModelBody method

void createDataModelBody(
  1. String pathPage,
  2. String pageName,
  3. String apiName,
  4. dynamic body, [
  5. bool isMultipart = false,
  6. List<String> paramPath = const [],
])

Implementation

void createDataModelBody(
  String pathPage,
  String pageName,
  String apiName,
  dynamic body, [
  bool isMultipart = false,
  List<String> paramPath = const [],
]) {
  final apiClassName = apiName.pascalCase;

  String classBody =
      '''${isMultipart ? "import 'dart:io';\n" : ''}import 'package:core/core.dart';

''';
  classBody += getBodyClass(
    apiClassName,
    'Body',
    '',
    body,
    true,
    isMultipart,
    paramPath,
  );

  final path = join(pathPage, 'data', 'models', 'body');
  DirectoryHelper.createDir(path);
  join(path, '${apiName.snakeCase}_body.dart').write(classBody);

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