Repository: flutter
Issue: flutter test --coverage won't include sync* functions into lcov.info
Labels: a: tests,tool,dependency: dart,has reproducible steps,P2,found in release: 2.8,found in release: 2.9,team-tool,triaged-tool

Assume we have flutter app with files like this:
**errors.dart:**


 ```
class ValidationError {
  final String? name;
  final String? feedback;
  final String? severity;

  ValidationError({
    this.name,
    this.feedback,
    this.severity,
  });

  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      other is ValidationError &&
          runtimeType == other.runtimeType &&
          name == other.name &&
          feedback == other.feedback &&
          severity == other.severity;

  @override
  int get hashCode => name.hashCode ^ feedback.hashCode ^ severity.hashCode;

  @override
  String toString() {
    return 'ValidationError{name: $name, feedback: $feedback, severity: $severity}';
  }
}
```


**validator.dart**

```
import 'package:flutter_app_for_issues/unit_test_coverage_issue/errors.dart';

class Validator {
  Iterable<ValidationError> validate(String input) sync* {
    if (input.isEmpty) {
      yield ValidationError(
        name: 'name',
        severity: 'critical',
        feedback: 'very bad',
      );
    }
  }
}

```

And test file:

**validator_test.dart**

```
import 'package:flutter_app_for_issues/unit_test_coverage_issue/errors.dart';
import 'package:flutter_app_for_issues/unit_test_coverage_issue/validator.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
  test(
    'return proper LocalValidationError on empty name',
    () {
      final result = Validator().validate('');
      expect(
        result,
        contains(
          ValidationError(
            name: 'name',
            severity: 'critical',
            feedback: 'very bad',
          ),
        ),
      );
    },
  );
 
}
```

Then we try to get test coverage:

`flutter test --coverage`
`genhtml coverage/lcov.info -o coverage`
`open coverage/index.html`

And we have no info about **validator.dart** file
![image](https://user-images.githubusercontent.com/16819254/148177471-2c43a1ec-8177-4038-984e-d366340a5d84.png)

There is no info about this file even in lcov.info file 
![image](https://user-images.githubusercontent.com/16819254/148177536-392a5c7f-ef97-41ed-8c6b-1ac51d18dc05.png)


But if I remove sync* keyword from the function flutter test --coverage works as expected. Also, if I add one more method to validator.dart so file becomes to looks like this:

```
import 'package:flutter_app_for_issues/unit_test_coverage_issue/errors.dart';

class Validator {
  Iterable<ValidationError> validate(String input) sync* {
    if (input.isEmpty) {
      yield ValidationError(
        name: 'name',
        severity: 'critical',
        feedback: 'very bad',
      );
    }
  }
  Iterable<ValidationError> validate1(String input) {
    if (input.isEmpty) {
      return [
        ValidationError(
          name: 'name',
          severity: 'critical',
          feedback: 'very bad',
        )
      ];
    }
    return [];
  }
}

```


And test file like this:

```
import 'package:flutter_app_for_issues/unit_test_coverage_issue/errors.dart';
import 'package:flutter_app_for_issues/unit_test_coverage_issue/validator.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
  test(
    'return proper LocalValidationError on empty name',
    () {
      final result = Validator().validate('');
      expect(
        result,
        contains(
          ValidationError(
            name: 'name',
            severity: 'critical',
            feedback: 'very bad',
          ),
        ),
      );
    },
  );
  test(
    'return proper1 LocalValidationError on empty name',
    () {
      final result = Validator().validate1('');
      expect(
        result,
        contains(
          ValidationError(
            name: 'name',
            severity: 'critical',
            feedback: 'very bad',
          ),
        ),
      );
    },
  );
}

```

lcov.info file will contain info about validator.dart file and result of html generation will show us info only about "not sync*" method:

![image](https://user-images.githubusercontent.com/16819254/148178098-d662dd9c-2891-48cb-9947-5be595a177d6.png)



result of `flutter doctor -v`:
![image](https://user-images.githubusercontent.com/16819254/148178252-44e51678-8a85-4a16-8979-513dc0db4350.png)