avoid_type_to_string   
回避
詳細
#DO 呼び出しを避けてください
悪い例
dart
void bar(Object other) {
  if (other.runtimeType.toString() == 'Bar') {
    doThing();
  }
}
Object baz(Thing myThing) {
  return getThingFromDatabase(key: myThing.runtimeType.toString());
}良い例
dart
void bar(Object other) {
  if (other is Bar) {
    doThing();
  }
}
class Thing {
  String get thingTypeKey => ...
}
Object baz(Thing myThing) {
  return getThingFromDatabase(key: myThing.thingTypeKey);
}有効にする
#avoid_type_to_string ルールを有効にするには、analysis_options.yaml ファイルの linter > rules の下に avoid_type_to_string を追加してください。
analysis_options.yaml
yaml
linter:
  rules:
    - avoid_type_to_string代わりに YAML マップ構文を使用して linter ルールを構成している場合は、linter > rules の下に avoid_type_to_string: true を追加してください。
analysis_options.yaml
yaml
linter:
  rules:
    avoid_type_to_string: true