<|start_filename|>lib/src/exception.dart<|end_filename|>
/// Exception thrown when doing user cancelled the login flow.
class CanceledByUserException implements Exception {
  const CanceledByUserException();
  String toString() => "CanceledByUserException";
}


<|start_filename|>lib/schemes/auth_token.dart<|end_filename|>
///The access token for using Twitter API.
class AuthToken {
  /// Oauth token
  final String _authToken;

  /// Oauth token secret
  final String _authTokenSecret;

  String get authToken => _authToken;
  String get authTokenSecret => _authTokenSecret;

  AuthToken(
    Map<String, dynamic> params,
  )   : this._authToken = params['oauth_token'],
        this._authTokenSecret = params['oauth_token_secret'];
}


<|start_filename|>test/twitter_login_test.dart<|end_filename|>
import 'package:flutter_test/flutter_test.dart';
import 'package:twitter_login/entity/user.dart';

void main() {
  TestWidgetsFlutterBinding.ensureInitialized();

  /// If your Twitter account does not have an email address,
  /// or if the API is not configured to retrieve email addresses,
  /// you may not be able to retrieve email addresses.
  group('user response json parse test', () {
    test('parse', () {
      final json = {
        'email': '<EMAIL>',
        'profile_image_url_https': 'https://test.com/',
        'name': 'test_name',
        'screen_name': 'test_screen_name',
      };

      final user = User(json);
      expect(user is User, isTrue);
    });

    test('email is null', () {
      final json = {
        'email': null,
        'profile_image_url_https': 'https://test.com/',
        'name': 'test_name',
        'screen_name': 'test_screen_name',
      };

      final user = User(json);
      expect(user is User, isTrue);
    });
  });
}
