Line data Source code
1 : import 'package:apptive_grid_core/apptive_grid_network.dart'; 2 : import 'package:apptive_grid_core/cache/apptive_grid_cache.dart'; 3 : 4 : /// Configuration options for [ApptiveGrid] 5 : class ApptiveGridOptions { 6 : /// Creates a configuration 7 58 : const ApptiveGridOptions({ 8 : this.environment = ApptiveGridEnvironment.production, 9 : this.authenticationOptions = const ApptiveGridAuthenticationOptions(), 10 : this.cache, 11 : }); 12 : 13 : /// Determines the API endpoint used 14 : final ApptiveGridEnvironment environment; 15 : 16 : /// Authentication for API 17 : final ApptiveGridAuthenticationOptions authenticationOptions; 18 : 19 : /// Implementation for Caching. Use this to cache/store values for faster initial Data 20 : /// This can also be used to enable offline mode sending 21 : final ApptiveGridCache? cache; 22 : 23 : /// Creates a copy of [ApptiveGridOptions] with the provided values 24 2 : ApptiveGridOptions copyWith({ 25 : ApptiveGridEnvironment? environment, 26 : ApptiveGridAuthenticationOptions? authenticationOptions, 27 : ApptiveGridCache? cache, 28 : }) { 29 2 : return ApptiveGridOptions( 30 1 : environment: environment ?? this.environment, 31 : authenticationOptions: 32 2 : authenticationOptions ?? this.authenticationOptions, 33 2 : cache: cache ?? this.cache, 34 : ); 35 : } 36 : 37 1 : @override 38 : String toString() { 39 4 : return 'ApptiveGridOptions(environment: $environment, authenticationOptions: $authenticationOptions, cache: $cache)'; 40 : } 41 : 42 1 : @override 43 : bool operator ==(Object other) { 44 1 : return other is ApptiveGridOptions && 45 3 : other.environment == environment && 46 3 : other.authenticationOptions == authenticationOptions && 47 3 : other.cache == other.cache; 48 : } 49 : 50 1 : @override 51 2 : int get hashCode => toString().hashCode; 52 : }