Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

why could not import the Result class from dart async

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:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

environment:
  sdk: ">=2.7.0 <3.0.0"

>Solution :

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';

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading