我在 dart 中对字符串使用 contains 方法,但收到这样的错误。
谁能告诉我在 dart 中使用
.contains
作为字符串有什么问题
这是我的代码
String isPdf = "https://www.africau.edu/images/default/sample.pdf";
isPdf.contains("pdf");
发生错误
The method 'contains' isn't defined for the type 'String'.
Try correcting the name to the name of an existing method, or defining a method named 'contains'.
在 vscode 中,quickfix 告诉我这一点
change the 'contains' method to 'oscontains'.
未为“List”类型定义“substring”方法。 尝试将名称更正为现有方法的名称,或定义名为“substring”的方法