Created
April 19, 2022 10:31
-
-
Save FlutterWiz/c43decd1db84f4ff668c60f16aabb66d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import 'package:bloc/bloc.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:freezed_annotation/freezed_annotation.dart'; | |
part 'localization_state.dart'; | |
part 'localization_cubit.freezed.dart'; | |
class LocalizationCubit extends Cubit<LocalizationState> { | |
LocalizationCubit() : super(const LocalizationState.initial()); | |
void updateAppLanguage() { | |
emit(state.copyWith(appLanguage: state.appLanguage.languageCode == "en" ? const Locale("tr") : const Locale("en"))); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment