createDataModelBody method

void createDataModelBody(
  1. String pathPage,
  2. String pageName,
  3. String apiName,
  4. bool bodyList,
)

Implementation

void createDataModelBody(
  String pathPage,
  String pageName,
  String apiName,
  bool bodyList,
) {
  final apiClassName = apiName.pascalCase;

  final path = join(pathPage, 'data', 'models', 'body');
  DirectoryHelper.createDir(path);

  join(path, '${apiName}_body.dart').write('''import 'package:core/core.dart';

class ${apiClassName}Body extends Equatable {
const ${apiClassName}Body({
  required this.email,
  required this.password,
});

final String email;
final String password;

Map<String, dynamic> toMap() {
  return {
    'email': email,
    'password': password,
  };
}

@override
List<Object?> get props => [email, password];
}''');

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