I want to import the Result from dart async, but after I import the dart async, the Result still could not be found. This is my classs:
import 'package:reddwarf_dict/models/login/cellphone_existence_check.dart';
import 'dart:async';
class LoginApi {
static Future<Result<CellphoneExistenceCheck>> checkPhoneExist(
String phone, String countryCode) async {
return Result.value(null);
}
}
this is the message that tell me could not import the Result
:
The name 'Result' isn't a type so it can't be used as a type argument.
what should I to to import the Result
success? The Dart environment SDK like this:
environment:
sdk: ">=2.7.0 <3.0.0"
CodePudding user response:
You need to add the async package to your Flutter project: flutter pub add async
Or with dart:
dart pub add async
And in your code you need this import:
import 'package:async/async.dart';