This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Future<void> main() async { | |
final user = await getCurrentUsernameAndEmailWithNamedParameters(); | |
print('Username is ${user.username}'); | |
print('Email is ${user.email}'); | |
final anotherUser = await getCurrentUsernameAndEmailWithNamedParameters(); | |
print('Username is ${anotherUser.$1}'); | |
print('Email is ${anotherUser.$2}'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final session = await Amplify.Auth.fetchAuthSession() as CognitoAuthSession; | |
final userTokenResult = session.userPoolTokensResult.type; | |
final result = switch (userTokenResult) { | |
AWSResultType.success => 'Successfully fetched the identityId', | |
AWSResultType.error => 'Failed to fetch the identityId' | |
}; | |
safePrint(result); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final session = await Amplify.Auth.fetchAuthSession() as CognitoAuthSession; | |
final userTokenResult = session.userPoolTokensResult.type; | |
if (userTokenResult == AWSResultType.success) { | |
safePrint('Successfully fetched the session'); | |
} else { | |
safePrint('Failed to fetch the session'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@override | |
Widget build(BuildContext context) { | |
return SizedBox.square( | |
dimension: 100, | |
child: | |
BlocBuilder<PreviousGroceryDetailsCubit, PreviousGroceryDetailsState>( | |
bloc: previousGroceryDetailsCubit, | |
builder: (context, state) { | |
return switch (state) { | |
PreviousGroceryDetailsSuccess _ => CachedNetworkImage( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
part of 'previous_grocery_item_cubit.dart'; | |
sealed class PreviousGroceryDetailsState extends Equatable {} | |
final class PreviousGroceryDetailsInitial extends PreviousGroceryDetailsState { | |
@override | |
List<Object?> get props => []; | |
} | |
final class PreviousGroceryDetailsLoading extends PreviousGroceryDetailsState { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
const names = <String>['Salih']; | |
print(names.runtimeType); | |
const nameSet = <String>{'Salih'}; | |
print(nameSet.runtimeType); | |
const nameMap = <String, String>{'name': 'String'}; | |
print(nameMap.runtimeType); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
final bike = Bike(); | |
bike.accelerate(); | |
final plane = Plane(); | |
plane.accelerate(); | |
final car = Car(); | |
car.accelerate(); | |
car.decelerate(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
final result = greeting(); | |
print(result); | |
final property = properties( | |
name: 'Salih', | |
surname: 'Guler', | |
city: 'Ankara', | |
age: 30, | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Future<void> _logOutUser(BuildContext context) async { | |
try { | |
await Amplify.Auth.signOut(); | |
context.go('/sign-in'); | |
} on Exception catch(error) { | |
logger.error('An error occurred: $error'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Future<void> _deleteUser() async { | |
try { | |
await Amplify.Auth.deleteUser(); | |
if (mounted) { | |
context.go('/sign-in'); | |
} | |
} on Exception catch(error) { | |
logger.error('An error occurred: $error'); | |
} | |
} |