
Performs a comprehensive project rename from 'barcode_scanner' to 'e_scan' (or 'eScan' for user-facing labels). This update spans all relevant files, including: - Application IDs and bundle identifiers for Android, iOS, macOS, and Linux. - VS Code launch configurations. - Dart package import paths. - Project names and titles in `pubspec.yaml`, `README.md`, and platform-specific configurations (e.g., CMakeLists, Info.plist, AndroidManifest).
45 lines
1.6 KiB
Dart
45 lines
1.6 KiB
Dart
import 'package:e_scan/backend/objectbox/entities/product/product_entity.dart';
|
|
import 'package:e_scan/backend/objectbox/objectbox_manager.dart';
|
|
import 'package:e_scan/backend/schema/user/user_struct.dart';
|
|
import 'package:e_scan/services/token_provider.dart';
|
|
import 'package:flutter/foundation.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
|
|
part 'profile_page_model.freezed.dart';
|
|
|
|
/// The provider for the AuthViewModel, using Riverpod's StateNotifierProvider
|
|
/// with autoDispose to manage the lifecycle of the view model.
|
|
final profilePageModelProvider =
|
|
StateNotifierProvider.autoDispose<ProfilePageModel, ProfilePageState>((
|
|
ref,
|
|
) {
|
|
return ProfilePageModel(
|
|
userConnectedProvider: ref.read(userConnectedProvider),
|
|
);
|
|
});
|
|
|
|
class ProfilePageModel extends StateNotifier<ProfilePageState> {
|
|
/// Constructor initializes the TaskRepository using the provider reference.
|
|
ProfilePageModel({required this.userConnectedProvider})
|
|
: super(const ProfilePageState());
|
|
|
|
final productStore = objectboxManager.store.box<ProductEntity>();
|
|
final UserConnectedProvider userConnectedProvider;
|
|
|
|
Future getMe({Function(UserStruct? value)? onSuccess}) async {
|
|
state = state.copyWith(loading: true);
|
|
final user = await userConnectedProvider.get();
|
|
onSuccess?.call(user);
|
|
state = state.copyWith(user: user, loading: false);
|
|
}
|
|
}
|
|
|
|
@freezed
|
|
abstract class ProfilePageState with _$ProfilePageState {
|
|
const factory ProfilePageState({
|
|
UserStruct? user,
|
|
@Default(false) bool loading,
|
|
}) = _ProfilePageState;
|
|
}
|