Skip to content

Commit

Permalink
Ignore unused import warning in generated client
Browse files Browse the repository at this point in the history
  • Loading branch information
walsha2 committed Nov 13, 2023
1 parent 174f4ea commit 578ae44
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/src/generators/base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ abstract class BaseGenerator {
BaseGeneratorOptions get options;

/// Method to generate file(s)
String getHeader() {
String getHeader({
String ignoreForFile = 'invalid_annotation_target',
}) {
String header = """
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: invalid_annotation_target
// ignore_for_file: $ignoreForFile
""";
return header;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/generators/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class ClientGenerator extends BaseGenerator {

// Client header
file.writeAsStringSync("""
${getHeader()}
${getHeader(ignoreForFile: 'invalid_annotation_target, unused_import')}
import 'dart:io' as io;
import 'dart:convert';
Expand Down

0 comments on commit 578ae44

Please sign in to comment.