saveToFile method

Future<File> saveToFile (
  1. [String filePath]
)

Save generated class to file. Defaults to app/models/LAST_ENDPOINT_PATH.dart

Implementation

Future<File> saveToFile([String filePath]) async {
  filePath = filePath ?? 'app/models/${endpoint.split('/').last}.dart';
  final contents = await generate();
  final file = File(filePath);
  return await file.writeAsString(contents);
}