Skip to content

Instantly share code, notes, and snippets.

View salihgueler's full-sized avatar
🖖
Aloha

Muhammed Salih Guler salihgueler

🖖
Aloha
View GitHub Profile
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}');
}
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);
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');
}
@override
Widget build(BuildContext context) {
return SizedBox.square(
dimension: 100,
child:
BlocBuilder<PreviousGroceryDetailsCubit, PreviousGroceryDetailsState>(
bloc: previousGroceryDetailsCubit,
builder: (context, state) {
return switch (state) {
PreviousGroceryDetailsSuccess _ => CachedNetworkImage(
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 {
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);
void main() {
final bike = Bike();
bike.accelerate();
final plane = Plane();
plane.accelerate();
final car = Car();
car.accelerate();
car.decelerate();
}
void main() {
final result = greeting();
print(result);
final property = properties(
name: 'Salih',
surname: 'Guler',
city: 'Ankara',
age: 30,
);
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');
}
}
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');
}
}