Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
36bc9e0f9e | ||
|
|
ac991431c8 | ||
|
|
587caa44c5 | ||
|
|
2e4c77888e | ||
|
|
f9bfb69254 | ||
|
|
d02d3b5fbd | ||
|
|
7661319b4f | ||
|
|
75415cc6ff | ||
|
|
843c11b200 | ||
|
|
0917c5132b | ||
|
|
b07af60778 | ||
|
|
8d801e52d9 | ||
|
|
7137cd2335 | ||
|
|
b98462ee8c | ||
|
|
83f4e065ed | ||
|
|
e236d811ce | ||
|
|
0b70194d8e | ||
|
|
c1cefb122b | ||
|
|
ded5516bb1 | ||
|
|
77651e2e95 | ||
|
|
0ae599d8f8 | ||
|
|
36ecf95ef2 | ||
|
|
9dbc092313 | ||
|
|
ad11a9e43f | ||
|
|
20a9c65229 | ||
|
|
c03cfdfa80 | ||
|
|
c69a84569b | ||
|
|
d99dae0ca9 | ||
|
|
5a0f37fd3c | ||
|
|
e5c92b26c5 | ||
|
|
7955ebb7d1 | ||
|
|
508b72a52e | ||
|
|
8d982c468f | ||
|
|
6ebfae9d5b | ||
|
|
926e45170d | ||
|
|
f9cbd16b28 | ||
|
|
3ae2e93531 | ||
|
|
a182a3504c | ||
|
|
88972b28b5 | ||
|
|
2c8e9a3fb4 | ||
|
|
086c17a217 | ||
|
|
9a7681680d | ||
|
|
823e009121 | ||
|
|
602647ff26 | ||
|
|
d9a553708b | ||
|
|
aaa8eba31b | ||
|
|
31a82e14cb | ||
|
|
e88eff28f0 | ||
|
|
720c63b6c6 | ||
|
|
ca2cc8bf6b | ||
|
|
d56c3f89db | ||
|
|
f7f5682924 | ||
|
|
b51749a01b | ||
|
|
5fd870c507 | ||
|
|
0c8ca3c51b | ||
|
|
d8d8fd9d16 | ||
|
|
96526c1972 | ||
|
|
c4618bbc1b | ||
|
|
9f2097a268 | ||
|
|
6fda0f5636 | ||
|
|
d7cd84e130 | ||
|
|
ba2f0cd265 | ||
|
|
3541fc725c | ||
|
|
c2727a0995 | ||
|
|
6e4b09f15e | ||
|
|
9076c9c66e | ||
|
|
86d581f5ea | ||
|
|
411d1274bd | ||
|
|
a4a12c6763 | ||
|
|
9b6e9c591d | ||
|
|
3985611a0e | ||
|
|
61dd2bbb2c | ||
|
|
91965667ec | ||
|
|
9775e09659 | ||
|
|
3f75bffd09 | ||
|
|
5a83bc4049 | ||
|
|
f07d07b3a8 | ||
|
|
1aa65d1732 | ||
|
|
50934bfed9 | ||
|
|
838707becf | ||
|
|
1b1e8c5bb4 | ||
|
|
7919825955 | ||
|
|
bfd4604897 | ||
|
|
60f43f6df7 | ||
|
|
811ac4b202 | ||
|
|
b731704a3d | ||
|
|
9b51bf2bee | ||
|
|
5b91b5978f | ||
|
|
590bb3329c | ||
|
|
de11c1243c | ||
|
|
06d777290d | ||
|
|
aac3eecf95 | ||
|
|
fb2309ddb3 | ||
|
|
a61b19e45c | ||
|
|
ac8c2c0f54 | ||
|
|
1f6e5e9a2b | ||
|
|
2d25e15380 | ||
|
|
b4d2d859eb | ||
|
|
c367bd2cd9 | ||
|
|
d3f2cb300c | ||
|
|
62eb15b27f | ||
|
|
b8055c8eab | ||
|
|
bc95336a19 | ||
|
|
d58198e7f0 | ||
|
|
b5593d10eb | ||
|
|
65ba81f311 | ||
|
|
51289d7829 | ||
|
|
d22ffdd6d0 | ||
|
|
577adb7964 | ||
|
|
b3c72cbbc0 | ||
|
|
8eef620c16 | ||
|
|
50b06da627 | ||
|
|
beb9ead4da | ||
|
|
6b1e56a46b | ||
|
|
d3543149f2 | ||
|
|
7d24b3296d | ||
|
|
82c0eaf5fe | ||
|
|
6cc2026f6f | ||
|
|
6df5380aa3 | ||
|
|
4a4f6388d7 | ||
|
|
f84090c0e6 | ||
|
|
e7525238fe | ||
|
|
5387d7b7a6 | ||
|
|
f138e1dcc9 | ||
|
|
e1bde24a83 | ||
|
|
edf067369d | ||
|
|
255b10d5a9 | ||
|
|
6019036cd7 | ||
|
|
d73cd1a574 | ||
|
|
d334bb8f17 | ||
|
|
9b398cabb6 | ||
|
|
ebfdb7274c | ||
|
|
ad2681dfde | ||
|
|
3115c02b0a | ||
|
|
71ebb26227 | ||
|
|
1fd76b9741 | ||
|
|
8c2afc4880 | ||
|
|
c9e5c8d178 | ||
|
|
ac17c4d830 | ||
|
|
16230febc4 | ||
|
|
2d6d93772e | ||
|
|
de42fc68a4 | ||
|
|
cb45f7db16 | ||
|
|
b6e4831602 | ||
|
|
97da18ca38 | ||
|
|
d29486571a | ||
|
|
83edfa61f1 | ||
|
|
3d43d7a934 | ||
|
|
e732a27914 | ||
|
|
43153f9b0d | ||
|
|
e13aeefa1c | ||
|
|
644531500d | ||
|
|
138640d47d | ||
|
|
795281f52d | ||
|
|
3fb4170d02 | ||
|
|
8fa20d03b6 | ||
|
|
f22c36d6de | ||
|
|
9458de5059 | ||
|
|
f0dac56802 | ||
|
|
ae1293d28d | ||
|
|
f8477d8a8c | ||
|
|
a9967a366f | ||
|
|
318d22d7c9 | ||
|
|
afc8476701 |
@@ -0,0 +1,171 @@
|
||||
name: Build & Deploy iOS to TestFlight
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: macos-26
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Flutter
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
channel: "stable"
|
||||
# Dipin biar CI nggak ikut naik versi diam-diam.
|
||||
# Flutter 3.47 mensyaratkan iOS deployment target minimal 15.0.
|
||||
flutter-version: "3.47.0"
|
||||
cache: true
|
||||
|
||||
- name: Install Dependencies
|
||||
run: flutter pub get
|
||||
|
||||
# ── Code Signing Setup ──────────────────────────────────────────────────
|
||||
|
||||
- name: Install Apple Certificate
|
||||
env:
|
||||
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
|
||||
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
|
||||
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
|
||||
run: |
|
||||
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
|
||||
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
|
||||
|
||||
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
|
||||
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
|
||||
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
|
||||
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
|
||||
|
||||
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A \
|
||||
-t cert -f pkcs12 -k $KEYCHAIN_PATH
|
||||
security set-key-partition-list -S apple-tool:,apple: \
|
||||
-s -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
|
||||
security list-keychain -d user -s $KEYCHAIN_PATH
|
||||
|
||||
- name: Install Provisioning Profile
|
||||
env:
|
||||
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
|
||||
run: |
|
||||
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
|
||||
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
|
||||
|
||||
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
|
||||
|
||||
# Xcode requires the filename to be the profile's UUID
|
||||
UUID=$(security cms -D -i $PP_PATH | plutil -extract UUID raw -)
|
||||
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles/$UUID.mobileprovision
|
||||
echo "Installed provisioning profile UUID: $UUID"
|
||||
|
||||
# ── Disable SPM ─────────────────────────────────────────────────────────
|
||||
|
||||
- name: Disable Swift Package Manager
|
||||
run: flutter config --no-enable-swift-package-manager
|
||||
|
||||
# ── CocoaPods ───────────────────────────────────────────────────────────
|
||||
|
||||
- name: Install CocoaPods Dependencies
|
||||
run: |
|
||||
cd ios
|
||||
rm -rf Pods Podfile.lock
|
||||
pod install --repo-update
|
||||
|
||||
# ── Build & Archive ─────────────────────────────────────────────────────
|
||||
|
||||
- name: Build iOS (no codesign)
|
||||
run: flutter build ios --release --no-codesign
|
||||
|
||||
- name: Re-run pod install to apply Podfile signing settings
|
||||
run: |
|
||||
cd ios
|
||||
pod install
|
||||
|
||||
- name: Archive with Xcode
|
||||
env:
|
||||
TEAM_ID: ${{ secrets.TEAM_ID }}
|
||||
run: |
|
||||
cat > $RUNNER_TEMP/signing.xcconfig << 'XCCONFIG'
|
||||
CODE_SIGN_STYLE = Manual
|
||||
CODE_SIGN_IDENTITY = iPhone Distribution
|
||||
PROVISIONING_PROFILE_SPECIFIER = Enaklo Owner App Store
|
||||
CODE_SIGNING_REQUIRED = YES
|
||||
XCCONFIG
|
||||
|
||||
xcodebuild archive \
|
||||
-workspace ios/Runner.xcworkspace \
|
||||
-scheme Runner \
|
||||
-configuration Release \
|
||||
-archivePath $RUNNER_TEMP/Runner.xcarchive \
|
||||
-destination "generic/platform=iOS" \
|
||||
-xcconfig $RUNNER_TEMP/signing.xcconfig \
|
||||
DEVELOPMENT_TEAM="$TEAM_ID"
|
||||
|
||||
- name: Export IPA
|
||||
run: |
|
||||
xcodebuild -exportArchive \
|
||||
-archivePath $RUNNER_TEMP/Runner.xcarchive \
|
||||
-exportPath $RUNNER_TEMP/export \
|
||||
-exportOptionsPlist ios/ExportOptions.plist
|
||||
|
||||
mkdir -p build/ios/ipa
|
||||
cp $RUNNER_TEMP/export/*.ipa build/ios/ipa/
|
||||
|
||||
- name: Upload dSYMs to Crashlytics
|
||||
env:
|
||||
GOOGLE_SERVICE_INFO_PLIST: ${{ secrets.GOOGLE_SERVICE_INFO_PLIST }}
|
||||
run: |
|
||||
# Find the Crashlytics upload-symbols binary from Pods
|
||||
UPLOAD_SYMBOLS=$(find ios/Pods -name "upload-symbols" -type f | head -1)
|
||||
|
||||
if [ -z "$UPLOAD_SYMBOLS" ]; then
|
||||
echo "upload-symbols binary not found, skipping dSYM upload"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Write GoogleService-Info.plist from secret
|
||||
echo -n "$GOOGLE_SERVICE_INFO_PLIST" | base64 --decode > $RUNNER_TEMP/GoogleService-Info.plist
|
||||
|
||||
# Upload dSYMs from the xcarchive
|
||||
"$UPLOAD_SYMBOLS" \
|
||||
-gsp $RUNNER_TEMP/GoogleService-Info.plist \
|
||||
-p ios \
|
||||
$RUNNER_TEMP/Runner.xcarchive/dSYMs
|
||||
|
||||
# ── Upload to TestFlight ────────────────────────────────────────────────
|
||||
|
||||
- name: Upload to TestFlight via Transporter
|
||||
env:
|
||||
APPLE_ID: ${{ secrets.APPLE_ID }}
|
||||
APP_SPECIFIC_PASSWORD: ${{ secrets.APP_SPECIFIC_PASSWORD }}
|
||||
run: |
|
||||
IPA_PATH=$(find build/ios/ipa -name "*.ipa" | head -1)
|
||||
echo "Uploading: $IPA_PATH"
|
||||
xcrun altool --upload-app \
|
||||
--type ios \
|
||||
--file "$IPA_PATH" \
|
||||
--username "$APPLE_ID" \
|
||||
--password "$APP_SPECIFIC_PASSWORD" \
|
||||
--verbose
|
||||
|
||||
# ── Cleanup ─────────────────────────────────────────────────────────────
|
||||
|
||||
- name: Clean Up Keychain and Provisioning Profile
|
||||
if: ${{ always() }}
|
||||
run: |
|
||||
security delete-keychain $RUNNER_TEMP/app-signing.keychain-db || true
|
||||
rm -rf ~/Library/MobileDevice/Provisioning\ Profiles/*.mobileprovision || true
|
||||
|
||||
# ── Artifact ────────────────────────────────────────────────────────────
|
||||
|
||||
- name: Upload IPA as Artifact
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ios-ipa
|
||||
path: build/ios/ipa/*.ipa
|
||||
retention-days: 7
|
||||
@@ -1,16 +1,619 @@
|
||||
# apskel_owner_flutter
|
||||
## Apskel Owner Flutter
|
||||
|
||||
A new Flutter project.
|
||||
A POS (Point of Sale) application for business owners, built with Flutter. The project follows a layered architecture (presentation → application → domain → infrastructure) with dependency injection, state management, automated routing, internationalization, and code generation.
|
||||
|
||||
## Getting Started
|
||||
---
|
||||
|
||||
This project is a starting point for a Flutter application.
|
||||
### Contents
|
||||
|
||||
A few resources to get you started if this is your first Flutter project:
|
||||
- Technical Summary
|
||||
- Requirements & Setup
|
||||
- Running the App
|
||||
- Architecture Overview
|
||||
- Project Structure
|
||||
- Key Dependencies & Purpose
|
||||
- Code Generation (see docs/codegen.md)
|
||||
- Internationalization (i18n)
|
||||
- Theming & Assets
|
||||
- Environment Configuration (`env.dart`)
|
||||
- Development Practices
|
||||
|
||||
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
|
||||
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
|
||||
---
|
||||
|
||||
For help getting started with Flutter development, view the
|
||||
[online documentation](https://docs.flutter.dev/), which offers tutorials,
|
||||
samples, guidance on mobile development, and a full API reference.
|
||||
## Technical Summary
|
||||
|
||||
- SDK: Flutter (Material) with Dart ^3.8.1
|
||||
- Targets: Android, iOS, Web, Desktop (Windows, macOS, Linux)
|
||||
- State management: `flutter_bloc`
|
||||
- Routing: `auto_route`
|
||||
- Dependency Injection: `get_it` + `injectable`
|
||||
- HTTP Client: `dio` (+ `awesome_dio_interceptor`)
|
||||
- Data class & serialization: `freezed` + `json_serializable`
|
||||
- Localization: `flutter_localizations`, `l10n/*.arb`
|
||||
- Assets generation: `flutter_gen`
|
||||
|
||||
---
|
||||
|
||||
## Requirements & Setup
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Flutter SDK installed as per the official guide (`https://flutter.dev/docs/get-started/install`)
|
||||
- Dart version per constraint: ^3.8.1
|
||||
- For code generation only: FVM + Flutter 3.41.9 (`dart pub global activate fvm && fvm install 3.41.9`) — see [docs/codegen.md](docs/codegen.md)
|
||||
|
||||
### Installation
|
||||
|
||||
```bash
|
||||
git clone <your-repo-url>
|
||||
cd apskel_owner_flutter
|
||||
flutter pub get
|
||||
```
|
||||
|
||||
### Code generation (required after clone or when annotations change)
|
||||
|
||||
> **Do not run codegen with Flutter 3.47 / Dart 3.13** — every builder crashes with
|
||||
> `Missing implementation of visitDotShorthandPropertyAccess`. Codegen must run on Flutter 3.41.9
|
||||
> (Dart 3.11.5) via FVM. Full setup, commands, and troubleshooting: **[docs/codegen.md](docs/codegen.md)**.
|
||||
|
||||
```powershell
|
||||
$FVM = "$env:USERPROFILE\fvm\versions\3.41.9\bin"
|
||||
|
||||
& "$FVM\flutter.bat" pub get
|
||||
& "$FVM\dart.bat" run build_runner build --delete-conflicting-outputs
|
||||
flutter pub get # restore lockfile resolution for the global SDK
|
||||
```
|
||||
|
||||
> Re-run whenever you change files using `@RoutePage()`, `@injectable`, `@freezed`, or `@JsonSerializable`.
|
||||
|
||||
---
|
||||
|
||||
## Running the App
|
||||
|
||||
```bash
|
||||
flutter run
|
||||
```
|
||||
|
||||
Select a specific device/platform:
|
||||
|
||||
```bash
|
||||
flutter run -d chrome
|
||||
flutter run -d ios
|
||||
flutter run -d android
|
||||
```
|
||||
|
||||
Example release builds:
|
||||
|
||||
```bash
|
||||
flutter build apk --release
|
||||
flutter build ios --release
|
||||
flutter build web --release
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Architecture Overview
|
||||
|
||||
The codebase follows a clean, layered approach that separates concerns and keeps features modular and testable:
|
||||
|
||||
- Presentation (`lib/presentation`): Widgets, pages/screens, and the `AutoRoute` router. Contains only UI code and wiring to BLoC/Cubit.
|
||||
- Application (`lib/application`): BLoC/Cubit and application-level orchestration. Holds input validation, state transitions, and calls into the Domain layer.
|
||||
- Domain (`lib/domain`): Pure business logic. Entities, value objects, repository interfaces, and (optional) use-cases. No framework dependencies.
|
||||
- Infrastructure (`lib/infrastructure`): Repository implementations, DTOs, and data sources (HTTP/DB). Performs `dio` calls and mappings between DTOs and Domain entities.
|
||||
- Common (`lib/common`): Cross-cutting helpers such as API base, DI setup, constants, extensions, theme, validators, and utilities.
|
||||
|
||||
Data flow in a feature:
|
||||
|
||||
1. UI triggers an intent/event in Presentation →
|
||||
2. Application layer BLoC/Cubit handles the event and calls a repository/use-case from Domain →
|
||||
3. Infrastructure implements the repository, performs network calls via `dio`, and maps results →
|
||||
4. Data is converted to Domain entities and returned to Application →
|
||||
5. Application updates state, Presentation rebuilds UI accordingly.
|
||||
|
||||
Cross-cutting concerns:
|
||||
|
||||
- Dependency Injection: `get_it` + `injectable` auto-register services/repositories (`injection.dart`, `injection.config.dart`).
|
||||
- Routing: `auto_route` defines typed routes, generated into router files in `presentation/router`.
|
||||
- State: `flutter_bloc` models states/events and isolates side-effects in BLoCs/Cubits.
|
||||
- Networking: `dio` with interceptors for logging and error handling.
|
||||
- Error handling: functional style with `dartz` (`Either`, `Option`) or well-defined BLoC states.
|
||||
- i18n: ARB files in `lib/l10n/` and generated localization delegates.
|
||||
- Theming: centralized theme under `lib/common/theme/` with shared design tokens.
|
||||
- Assets: managed under `assets/` and referenced via FlutterGen outputs at `lib/presentation/components/assets/`.
|
||||
|
||||
---
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
lib/
|
||||
application/ # BLoC/cubit per feature (analytic, auth, product, etc.)
|
||||
common/
|
||||
api/ # Base API client, endpoint helper
|
||||
constant/ # Application constants
|
||||
di/ # Dependency injection setup (get_it, injectable)
|
||||
extension/ # Extensions
|
||||
function/ # General utility functions
|
||||
network/ # Connectivity checks, handlers
|
||||
painter/ # Custom painters
|
||||
theme/ # Colors, text styles, theming
|
||||
url/ # Base URL/endpoints
|
||||
utils/ # Other helpers
|
||||
validator/ # Input validators
|
||||
domain/
|
||||
<feature>/ # Entities, repo interfaces, (use-cases if present)
|
||||
infrastructure/
|
||||
<feature>/ # Repo implementations, DTOs, API calls
|
||||
l10n/ # ARB sources for i18n + generated localizations
|
||||
presentation/
|
||||
components/ # Reusable widgets
|
||||
pages/ # Feature pages/screens
|
||||
router/ # AutoRoute definitions
|
||||
env.dart # Environment configuration (BASE_URL, etc.)
|
||||
injection.dart # DI entry point
|
||||
injection.config.dart # DI generated
|
||||
main.dart # Application entry point
|
||||
assets/
|
||||
images/, icons/, json/, fonts/
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Key Dependencies & Purpose
|
||||
|
||||
Runtime:
|
||||
|
||||
- `auto_route`: Automated, typed routing based on annotations.
|
||||
- `flutter_bloc`: State management with BLoC/Cubit.
|
||||
- `get_it`, `injectable`: Service locator + codegen for DI.
|
||||
- `dio`, `awesome_dio_interceptor`: HTTP client + logging interceptor.
|
||||
- `freezed_annotation`, `json_annotation`: Annotations for immutable data classes & JSON.
|
||||
- `dartz`: Functional types (Either, Option) for explicit error handling.
|
||||
- `connectivity_plus`, `device_info_plus`, `package_info_plus`: Device and connectivity info.
|
||||
- `shared_preferences`: Local key-value storage.
|
||||
- `image_picker`, `permission_handler`, `open_file`, `url_launcher`: OS/device integrations.
|
||||
- UI: `flutter_svg`, `line_icons`, `flutter_spinkit`, `fl_chart`, `another_flushbar`, `table_calendar`, `shimmer`, `cached_network_image`, `syncfusion_flutter_datepicker`, `pdf`.
|
||||
|
||||
Dev:
|
||||
|
||||
- `build_runner`: Code generation orchestration.
|
||||
- `auto_route_generator`, `injectable_generator`, `freezed`, `json_serializable`: Related generators.
|
||||
- `flutter_gen_runner`: Typed asset access generator.
|
||||
- `flutter_lints`: Recommended Flutter lints.
|
||||
- `flutter_launcher_icons`: Launcher icon generation.
|
||||
|
||||
Refer to `pubspec.yaml` for full version constraints.
|
||||
|
||||
---
|
||||
|
||||
## Code Generation
|
||||
|
||||
**Full guide: [docs/codegen.md](docs/codegen.md)** — read it before your first codegen run.
|
||||
|
||||
Codegen runs on a pinned SDK (Flutter 3.41.9 / Dart 3.11.5 via FVM), not on the global Flutter 3.47:
|
||||
`freezed 2.5.8` caps `analyzer` below 8.0.0, and analyzer 7.7.1 crashes on the dot-shorthand syntax
|
||||
used by Dart 3.13 sources. The app itself still runs and builds with the global SDK.
|
||||
|
||||
Common commands:
|
||||
|
||||
```powershell
|
||||
$FVM = "$env:USERPROFILE\fvm\versions\3.41.9\bin"
|
||||
|
||||
& "$FVM\flutter.bat" pub get
|
||||
& "$FVM\dart.bat" run build_runner build --delete-conflicting-outputs
|
||||
# or watch
|
||||
& "$FVM\dart.bat" run build_runner watch --delete-conflicting-outputs
|
||||
flutter pub get # restore lockfile resolution for the global SDK
|
||||
```
|
||||
|
||||
> `--delete-conflicting-outputs` wipes every generated file first. If you cancel the build midway,
|
||||
> restore them with `git checkout` — see the troubleshooting table in [docs/codegen.md](docs/codegen.md).
|
||||
|
||||
### Asset generation (flutter_gen_runner)
|
||||
|
||||
`flutter_gen_runner` is integrated with `build_runner`. Running the commands above will also generate typed accessors for assets based on the `flutter_gen` section in `pubspec.yaml`:
|
||||
|
||||
- Output path: `lib/presentation/components/assets/`
|
||||
- SVG integration: enabled (`flutter_svg: true`)
|
||||
|
||||
Usage in code example (after generation):
|
||||
|
||||
```dart
|
||||
// Example usage
|
||||
// import 'presentation/components/assets/assets.gen.dart';
|
||||
// Image.asset(Assets.images.logo.path);
|
||||
```
|
||||
|
||||
Generators used:
|
||||
|
||||
- AutoRoute: Generates router and typed routes.
|
||||
- Injectable: Generates DI registrations (`injection.config.dart`).
|
||||
- Freezed: Generates immutable data classes, copyWith, unions, etc.
|
||||
- Json Serializable: Generates toJson/fromJson for DTOs.
|
||||
- FlutterGen: Generates static asset access under `lib/presentation/components/assets/`.
|
||||
|
||||
---
|
||||
|
||||
## Internationalization (i18n)
|
||||
|
||||
- Source files live in `lib/l10n/app_*.arb` (e.g., `app_en.arb`, `app_id.arb`).
|
||||
- To add a language: create `app_<code>.arb`, then run code generation.
|
||||
- Ensure `MaterialApp` is wired with `localizationsDelegates` and `supportedLocales` (already prepared).
|
||||
|
||||
---
|
||||
|
||||
## Theming & Assets
|
||||
|
||||
- Theme files live under `lib/common/theme/`.
|
||||
- Fonts: `Quicksand` family is declared in `pubspec.yaml`.
|
||||
- Assets: `assets/images/`, `assets/icons/`, `assets/json/` – referenced via FlutterGen outputs at `lib/presentation/components/assets/`.
|
||||
|
||||
---
|
||||
|
||||
## Environment Configuration (`env.dart`)
|
||||
|
||||
The `lib/env.dart` file stores configuration values such as base URLs and debug flags. Adjust per environment (development/production) using flavors, environment variables, or branching as preferred by the team.
|
||||
|
||||
---
|
||||
|
||||
## Development Practices
|
||||
|
||||
- Routing: Define routes in `presentation/router`, then run code generation.
|
||||
- DI: Annotate services/repositories with `@injectable`/`@LazySingleton`, generate code, and call `configureDependencies()` early in app startup.
|
||||
- BLoC: Keep UI logic in the `application` layer and use `BlocBuilder`/`BlocListener` in the `presentation` layer.
|
||||
- DTO ↔ Entity: Mapping resides in the `infrastructure` layer to keep domain pure.
|
||||
- Error handling: Prefer `Either`/`Option` (`dartz`) or well-structured BLoC states.
|
||||
- Linting: Follow `analysis_options.yaml`.
|
||||
|
||||
---
|
||||
|
||||
## Useful Commands
|
||||
|
||||
```bash
|
||||
# Install dependencies
|
||||
flutter pub get
|
||||
|
||||
# Format & Analyze
|
||||
flutter format .
|
||||
flutter analyze
|
||||
|
||||
# Localization (safe on the global SDK)
|
||||
flutter gen-l10n
|
||||
|
||||
# Run by device
|
||||
flutter devices
|
||||
flutter run -d <device-id>
|
||||
```
|
||||
|
||||
Code generation uses the pinned FVM SDK — see [docs/codegen.md](docs/codegen.md):
|
||||
|
||||
```powershell
|
||||
& "$env:USERPROFILE\fvm\versions\3.41.9\bin\dart.bat" run build_runner build --delete-conflicting-outputs
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Additional Notes
|
||||
|
||||
- Launcher icons configured via `launcher_icon.yaml`.
|
||||
- Platform-specific configuration (Android/iOS/Web/Desktop) resides in respective platform folders.
|
||||
- Review `analysis_options.yaml` for code style and lint rules.
|
||||
|
||||
---
|
||||
|
||||
## Launcher Icons
|
||||
|
||||
Configured via `launcher_icon.yaml` at the repository root. To (re)generate launcher icons, run:
|
||||
|
||||
```bash
|
||||
dart run flutter_launcher_icons -f launcher_icon.yaml
|
||||
```
|
||||
|
||||
If you prefer the Flutter shim:
|
||||
|
||||
```bash
|
||||
flutter pub run flutter_launcher_icons -f launcher_icon.yaml
|
||||
```
|
||||
|
||||
Ensure you have the package in `dev_dependencies` (`flutter_launcher_icons`).
|
||||
|
||||
## Contributing
|
||||
|
||||
1. Branch off `main`.
|
||||
2. Make focused changes and provide a clear PR description.
|
||||
3. Ensure build, lints, and codegen are clean before opening the PR.
|
||||
|
||||
---
|
||||
|
||||
## License
|
||||
|
||||
This project is private/internal. Contact the repository owner for usage permissions.
|
||||
|
||||
## Apskel Owner Flutter
|
||||
|
||||
Aplikasi Point of Sale (POS) untuk pemilik usaha, dibangun dengan Flutter. Proyek ini menerapkan arsitektur berlapis (presentation → application → domain → infrastructure) dengan dependency injection, state management, routing terotomasi, internationalization, dan code generation.
|
||||
|
||||
---
|
||||
|
||||
### Isi Dokumen
|
||||
|
||||
- Ringkasan Teknis
|
||||
- Persyaratan & Setup
|
||||
- Menjalankan Aplikasi
|
||||
- Arsitektur & Alur
|
||||
- Struktur Proyek
|
||||
- Dependensi Utama & Fungsinya
|
||||
- Code Generation (lihat docs/codegen.md)
|
||||
- Internationalization (i18n)
|
||||
- Theming & Assets
|
||||
- Konfigurasi Lingkungan (`env.dart`)
|
||||
- Praktik Pengembangan
|
||||
|
||||
---
|
||||
|
||||
## Ringkasan Teknis
|
||||
|
||||
- SDK: Flutter (Material) dengan Dart ^3.8.1
|
||||
- Target platform: Android, iOS, Web, Desktop (Windows, macOS, Linux)
|
||||
- State management: `flutter_bloc`
|
||||
- Routing: `auto_route`
|
||||
- Dependency Injection: `get_it` + `injectable`
|
||||
- HTTP Client: `dio` (+ `awesome_dio_interceptor`)
|
||||
- Data class & serialization: `freezed` + `json_serializable`
|
||||
- Localization: `flutter_localizations`, `l10n/*.arb`
|
||||
- Assets generation: `flutter_gen`
|
||||
|
||||
---
|
||||
|
||||
## Persyaratan & Setup
|
||||
|
||||
### Prasyarat
|
||||
|
||||
- Flutter SDK terpasang sesuai panduan resmi (`https://flutter.dev/docs/get-started/install`)
|
||||
- Versi Dart sesuai constraint: ^3.8.1
|
||||
- Khusus untuk code generation: FVM + Flutter 3.41.9 (`dart pub global activate fvm && fvm install 3.41.9`) — lihat [docs/codegen.md](docs/codegen.md)
|
||||
|
||||
### Instalasi
|
||||
|
||||
```bash
|
||||
git clone <repo-url-anda>
|
||||
cd apskel_owner_flutter
|
||||
flutter pub get
|
||||
```
|
||||
|
||||
### Generate kode (wajib setelah clone atau mengubah anotasi)
|
||||
|
||||
> **Jangan jalankan codegen dengan Flutter 3.47 / Dart 3.13** — semua builder crash dengan
|
||||
> `Missing implementation of visitDotShorthandPropertyAccess`. Codegen harus memakai Flutter 3.41.9
|
||||
> (Dart 3.11.5) via FVM. Setup, perintah, dan troubleshooting lengkap: **[docs/codegen.md](docs/codegen.md)**.
|
||||
|
||||
```powershell
|
||||
$FVM = "$env:USERPROFILE\fvm\versions\3.41.9\bin"
|
||||
|
||||
& "$FVM\flutter.bat" pub get
|
||||
& "$FVM\dart.bat" run build_runner build --delete-conflicting-outputs
|
||||
flutter pub get # kembalikan resolusi lockfile ke SDK global
|
||||
```
|
||||
|
||||
> Jalankan ulang perintah di atas setiap kali Anda mengubah file yang menggunakan anotasi `@RoutePage()`, `@injectable`, `@freezed`, atau `@JsonSerializable`.
|
||||
|
||||
---
|
||||
|
||||
## Menjalankan Aplikasi
|
||||
|
||||
```bash
|
||||
flutter run
|
||||
```
|
||||
|
||||
Menentukan platform/target tertentu:
|
||||
|
||||
```bash
|
||||
flutter run -d chrome
|
||||
flutter run -d ios
|
||||
flutter run -d android
|
||||
```
|
||||
|
||||
Build release contoh:
|
||||
|
||||
```bash
|
||||
flutter build apk --release
|
||||
flutter build ios --release
|
||||
flutter build web --release
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Arsitektur & Alur
|
||||
|
||||
Proyek mengikuti layering yang jelas:
|
||||
|
||||
- Presentation (`lib/presentation`): UI, widget, halaman, router.
|
||||
- Application (`lib/application`): BLoC/cubit, use-case orkestra ringan, validasi input UI.
|
||||
- Domain (`lib/domain`): Entitas, value object, repository interface, use-case (jika ada).
|
||||
- Infrastructure (`lib/infrastructure`): Implementasi repository, data source (API/DB), mapping DTO.
|
||||
- Common (`lib/common`): Utilitas umum, konstanta, theme, API base, DI bootstrap, extension, dll.
|
||||
|
||||
Alur umum:
|
||||
|
||||
1. UI memicu event →
|
||||
2. BLoC di layer Application memanggil use-case/repo (Domain) →
|
||||
3. Implementasi repo (Infrastructure) melakukan HTTP via `dio` →
|
||||
4. Response dipetakan menjadi entity/domain →
|
||||
5. State di-update kembali ke UI.
|
||||
|
||||
---
|
||||
|
||||
## Struktur Proyek
|
||||
|
||||
```
|
||||
lib/
|
||||
application/ # BLoC/cubit per fitur (analytic, auth, product, dst.)
|
||||
common/
|
||||
api/ # Base API client, endpoint helper
|
||||
constant/ # Konstanta aplikasi
|
||||
di/ # Setup dependency injection (get_it, injectable)
|
||||
extension/ # Extension util
|
||||
function/ # Fungsi util umum
|
||||
network/ # Cek konektivitas, handler
|
||||
painter/ # Custom painter
|
||||
theme/ # Warna, text styles, theming
|
||||
url/ # Base URL/endpoint
|
||||
utils/ # Helper lain
|
||||
validator/ # Validator input
|
||||
domain/
|
||||
<feature>/ # Entity, repo interface, (use-case bila ada)
|
||||
infrastructure/
|
||||
<feature>/ # Repo implementation, DTO, pemanggilan API
|
||||
l10n/ # Berkas ARB untuk i18n + generated localizations
|
||||
presentation/
|
||||
components/ # Widget reusable
|
||||
pages/ # Halaman/layar fitur
|
||||
router/ # Definisi AutoRoute
|
||||
env.dart # Konfigurasi environment (BASE_URL, dsb)
|
||||
injection.dart # Entry point DI
|
||||
injection.config.dart # DI generated
|
||||
main.dart # Entrypoint aplikasi
|
||||
assets/
|
||||
images/, icons/, json/, fonts/
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Dependensi Utama & Fungsinya
|
||||
|
||||
Runtime:
|
||||
|
||||
- `auto_route`: Routing terotomasi berbasis anotasi.
|
||||
- `flutter_bloc`: State management dengan BLoC/Cubit.
|
||||
- `get_it`, `injectable`: Service locator + codegen untuk DI.
|
||||
- `dio`, `awesome_dio_interceptor`: HTTP client + logging interceptor.
|
||||
- `freezed_annotation`, `json_annotation`: Anotasi untuk data class immutable & JSON.
|
||||
- `dartz`: Functional types (Either, Option) untuk error handling yang eksplisit.
|
||||
- `connectivity_plus`, `device_info_plus`, `package_info_plus`: Info perangkat & konektivitas.
|
||||
- `shared_preferences`: Penyimpanan key-value lokal.
|
||||
- `image_picker`, `permission_handler`, `open_file`, `url_launcher`: Integrasi perangkat/OS.
|
||||
- UI: `flutter_svg`, `line_icons`, `flutter_spinkit`, `fl_chart`, `another_flushbar`, `table_calendar`, `shimmer`, `cached_network_image`, `syncfusion_flutter_datepicker`, `pdf`.
|
||||
|
||||
Dev:
|
||||
|
||||
- `build_runner`: Orkestrasi code generation.
|
||||
- `auto_route_generator`, `injectable_generator`, `freezed`, `json_serializable`: Generator terkait.
|
||||
- `flutter_gen_runner`: Generator akses asset terketik.
|
||||
- `flutter_lints`: Linter rekomendasi Flutter.
|
||||
- `flutter_launcher_icons`: Generate icon launcher.
|
||||
|
||||
Catatan versi lengkap tersedia di `pubspec.yaml`.
|
||||
|
||||
---
|
||||
|
||||
## Code Generation
|
||||
|
||||
**Panduan lengkap: [docs/codegen.md](docs/codegen.md)** — baca dulu sebelum codegen pertama kali.
|
||||
|
||||
Codegen dijalankan dengan SDK terpisah (Flutter 3.41.9 / Dart 3.11.5 via FVM), bukan Flutter global 3.47:
|
||||
`freezed 2.5.8` mengunci `analyzer` di bawah 8.0.0, dan analyzer 7.7.1 crash pada sintaks *dot-shorthand*
|
||||
milik Dart 3.13. Aplikasinya sendiri tetap di-`run`/`build` dengan SDK global.
|
||||
|
||||
Perintah umum:
|
||||
|
||||
```powershell
|
||||
$FVM = "$env:USERPROFILE\fvm\versions\3.41.9\bin"
|
||||
|
||||
& "$FVM\flutter.bat" pub get
|
||||
& "$FVM\dart.bat" run build_runner build --delete-conflicting-outputs
|
||||
# atau untuk watch
|
||||
& "$FVM\dart.bat" run build_runner watch --delete-conflicting-outputs
|
||||
flutter pub get # kembalikan resolusi lockfile ke SDK global
|
||||
```
|
||||
|
||||
> `--delete-conflicting-outputs` menghapus semua file generated lebih dulu. Kalau build dibatalkan di
|
||||
> tengah jalan, pulihkan dengan `git checkout` — lihat tabel troubleshooting di [docs/codegen.md](docs/codegen.md).
|
||||
|
||||
Generator yang digunakan:
|
||||
|
||||
- AutoRoute: menghasilkan deklarasi router & route.
|
||||
- Injectable: menghasilkan registrasi DI (`injection.config.dart`).
|
||||
- Freezed: menghasilkan data class immutable, copyWith, union, dsb.
|
||||
- Json Serializable: menghasilkan toJson/fromJson untuk DTO.
|
||||
- FlutterGen: menghasilkan akses asset statis di `lib/presentation/components/assets/`.
|
||||
|
||||
---
|
||||
|
||||
## Internationalization (i18n)
|
||||
|
||||
- Berkas sumber ada di `lib/l10n/app_*.arb` (contoh: `app_en.arb`, `app_id.arb`).
|
||||
- Bahasa baru: tambahkan `app_<kode>.arb`, jalankan code generation.
|
||||
- Pastikan `MaterialApp` menggunakan `localizationsDelegates` dan `supportedLocales` (sudah disiapkan).
|
||||
|
||||
---
|
||||
|
||||
## Theming & Assets
|
||||
|
||||
- Theme ada di `lib/common/theme/`.
|
||||
- Font: keluarga `Quicksand` dideklarasikan di `pubspec.yaml`.
|
||||
- Assets: `assets/images/`, `assets/icons/`, `assets/json/` – akses via FlutterGen yang dihasilkan ke `lib/presentation/components/assets/`.
|
||||
|
||||
---
|
||||
|
||||
## Konfigurasi Lingkungan (`env.dart`)
|
||||
|
||||
File `lib/env.dart` menyimpan nilai konfigurasi seperti base URL, flag debug, dll. Sesuaikan untuk development/production (bisa dengan flavor, env var, atau branch khusus sesuai kebutuhan tim).
|
||||
|
||||
---
|
||||
|
||||
## Praktik Pengembangan
|
||||
|
||||
- Routing: definisikan route di `presentation/router`, jalankan codegen.
|
||||
- DI: daftarkan service/repository dengan anotasi `@injectable`/`@LazySingleton`, lalu generate, dan panggil `configureDependencies()` di awal aplikasi.
|
||||
- BLoC: simpan logic UI di layer `application` dan gunakan `BlocBuilder`/`BlocListener` di layer `presentation`.
|
||||
- DTO ↔ Entity: mapping berada di layer `infrastructure` untuk menjaga domain tetap bersih.
|
||||
- Error handling: gunakan `Either`/`Option` (`dartz`) atau state terstruktur di BLoC.
|
||||
- Lint: patuhi aturan `analysis_options.yaml`.
|
||||
|
||||
---
|
||||
|
||||
## Perintah Berguna
|
||||
|
||||
```bash
|
||||
# Install dependencies
|
||||
flutter pub get
|
||||
|
||||
# Format & Analyze
|
||||
flutter format .
|
||||
flutter analyze
|
||||
|
||||
# Localization (aman dengan SDK global)
|
||||
flutter gen-l10n
|
||||
|
||||
# Run by device
|
||||
flutter devices
|
||||
flutter run -d <device-id>
|
||||
```
|
||||
|
||||
Code generation memakai SDK FVM yang di-pin — lihat [docs/codegen.md](docs/codegen.md):
|
||||
|
||||
```powershell
|
||||
& "$env:USERPROFILE\fvm\versions\3.41.9\bin\dart.bat" run build_runner build --delete-conflicting-outputs
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Catatan Tambahan
|
||||
|
||||
- Icon launcher dikonfigurasi di `launcher_icon.yaml` (gunakan `flutter pub run flutter_launcher_icons` bila diperlukan).
|
||||
- Konfigurasi platform (Android/iOS/Web/Desktop) berada pada folder platform terkait.
|
||||
- Pastikan meninjau `analysis_options.yaml` untuk standar code style dan lints.
|
||||
|
||||
---
|
||||
|
||||
## Kontribusi
|
||||
|
||||
1. Buat branch dari `main`.
|
||||
2. Lakukan perubahan terfokus dan sertakan deskripsi yang jelas pada PR.
|
||||
3. Pastikan build, lints, dan codegen bersih sebelum mengajukan PR.
|
||||
|
||||
---
|
||||
|
||||
## Lisensi
|
||||
|
||||
Proyek ini bersifat privat/internal. Hubungi pemilik repositori untuk detail izin penggunaan.
|
||||
|
||||
@@ -13,7 +13,16 @@ analyzer:
|
||||
sort_unnamed_constructors_first: ignore
|
||||
invalid_annotation_target: ignore
|
||||
use_build_context_synchronously: ignore
|
||||
deprecated_member_use: ignore
|
||||
depend_on_referenced_packages: ignore
|
||||
exclude:
|
||||
- test/generated/**
|
||||
- "**/**.g.dart"
|
||||
- "**/**.freezed.dart"
|
||||
- build/**
|
||||
- android/**
|
||||
- ios/**
|
||||
- web/**
|
||||
- windows/**
|
||||
- macos/**
|
||||
- linux/**
|
||||
|
||||
@@ -3,14 +3,16 @@ plugins {
|
||||
id("kotlin-android")
|
||||
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
|
||||
id("dev.flutter.flutter-gradle-plugin")
|
||||
id("com.google.gms.google-services")
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.example.apskel_owner_flutter"
|
||||
namespace = "com.apskel.enaklo_owner"
|
||||
compileSdk = flutter.compileSdkVersion
|
||||
ndkVersion = flutter.ndkVersion
|
||||
ndkVersion = "27.0.12077973"
|
||||
|
||||
compileOptions {
|
||||
isCoreLibraryDesugaringEnabled = true
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
}
|
||||
@@ -21,7 +23,7 @@ android {
|
||||
|
||||
defaultConfig {
|
||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||
applicationId = "com.example.apskel_owner_flutter"
|
||||
applicationId = "com.apskel.enaklo_owner"
|
||||
// You can update the following values to match your application needs.
|
||||
// For more information, see: https://flutter.dev/to/review-gradle-config.
|
||||
minSdk = flutter.minSdkVersion
|
||||
@@ -42,3 +44,7 @@ android {
|
||||
flutter {
|
||||
source = "../.."
|
||||
}
|
||||
|
||||
dependencies {
|
||||
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.4")
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"project_info": {
|
||||
"project_number": "765730035527",
|
||||
"project_id": "apskel-pos-v2",
|
||||
"storage_bucket": "apskel-pos-v2.firebasestorage.app"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:765730035527:android:beffb797b781e715241e62",
|
||||
"android_client_info": {
|
||||
"package_name": "com.apskel.enaklo_owner"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyAOZwVSQwUeeM9BjcyTOK9GUh8AmTWucuc"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": []
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:765730035527:android:498defd7071336dd241e62",
|
||||
"android_client_info": {
|
||||
"package_name": "com.apskel.pos"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyAOZwVSQwUeeM9BjcyTOK9GUh8AmTWucuc"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
||||
@@ -1,6 +1,19 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO"/>
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO"/>
|
||||
<!-- FCM: required for POST_NOTIFICATIONS on Android 13+ -->
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
||||
<!-- FCM: allow background processing after device reboot -->
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
||||
<!-- FCM: allow wake lock for background message processing -->
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||
|
||||
<application
|
||||
android:label="apskel_owner_flutter"
|
||||
android:label="Grow Food"
|
||||
android:name="${applicationName}"
|
||||
android:icon="@mipmap/launcher_icon">
|
||||
<activity
|
||||
@@ -30,6 +43,30 @@
|
||||
<meta-data
|
||||
android:name="flutterEmbedding"
|
||||
android:value="2" />
|
||||
|
||||
<!-- FCM: default notification channel for Android 8+ -->
|
||||
<meta-data
|
||||
android:name="com.google.firebase.messaging.default_notification_channel_id"
|
||||
android:value="high_importance_channel" />
|
||||
|
||||
<!-- FCM: default notification icon -->
|
||||
<meta-data
|
||||
android:name="com.google.firebase.messaging.default_notification_icon"
|
||||
android:resource="@drawable/ic_notification" />
|
||||
|
||||
<!-- FCM: default notification color -->
|
||||
<meta-data
|
||||
android:name="com.google.firebase.messaging.default_notification_color"
|
||||
android:resource="@color/notification_color" />
|
||||
|
||||
<!-- FCM: background message handler service -->
|
||||
<service
|
||||
android:name="com.google.firebase.messaging.FirebaseMessagingService"
|
||||
android:exported="false">
|
||||
<intent-filter android:priority="-500">
|
||||
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
|
||||
</intent-filter>
|
||||
</service>
|
||||
</application>
|
||||
<!-- Required to query activities that can process text, see:
|
||||
https://developer.android.com/training/package-visibility and
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.example.apskel_owner_flutter
|
||||
package com.apskel.enaklo_owner
|
||||
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 8.8 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 133 KiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 27 KiB |
@@ -1,4 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#ffffff</color>
|
||||
<!-- FCM: notification accent color -->
|
||||
<color name="notification_color">#FF6B35</color>
|
||||
</resources>
|
||||
@@ -1,3 +1,7 @@
|
||||
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
# This builtInKotlin flag was added automatically by Flutter migrator
|
||||
android.builtInKotlin=false
|
||||
# This newDsl flag was added automatically by Flutter migrator
|
||||
android.newDsl=false
|
||||
|
||||
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-all.zip
|
||||
|
||||
@@ -18,8 +18,9 @@ pluginManagement {
|
||||
|
||||
plugins {
|
||||
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
|
||||
id("com.android.application") version "8.7.3" apply false
|
||||
id("org.jetbrains.kotlin.android") version "2.1.0" apply false
|
||||
id("com.android.application") version "8.11.1" apply false
|
||||
id("org.jetbrains.kotlin.android") version "2.2.20" apply false
|
||||
id("com.google.gms.google-services") version "4.4.2" apply false
|
||||
}
|
||||
|
||||
include(":app")
|
||||
|
||||
|
After Width: | Height: | Size: 498 KiB |
|
After Width: | Height: | Size: 145 KiB |
|
After Width: | Height: | Size: 158 KiB |
|
After Width: | Height: | Size: 152 KiB |
|
After Width: | Height: | Size: 152 KiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 952 KiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 2.0 MiB |
@@ -0,0 +1,4 @@
|
||||
description: This file stores settings for Dart & Flutter DevTools.
|
||||
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
|
||||
extensions:
|
||||
- shared_preferences: true
|
||||
@@ -0,0 +1,163 @@
|
||||
# Code Generation (build_runner)
|
||||
|
||||
> **PENTING:** `build_runner` di proyek ini **tidak bisa** dijalankan dengan Flutter 3.47 / Dart 3.13.
|
||||
> Gunakan SDK Flutter 3.41.9 (Dart 3.11.5) lewat FVM. Aplikasinya sendiri tetap di-`run`/`build`
|
||||
> dengan Flutter versi global (3.47).
|
||||
|
||||
---
|
||||
|
||||
## TL;DR
|
||||
|
||||
PowerShell (Windows):
|
||||
|
||||
```powershell
|
||||
$FVM = "$env:USERPROFILE\fvm\versions\3.41.9\bin"
|
||||
|
||||
& "$FVM\flutter.bat" pub get # 1. resolve paket dgn Dart 3.11.5
|
||||
& "$FVM\dart.bat" run build_runner build --delete-conflicting-outputs # 2. generate
|
||||
flutter pub get # 3. balik ke SDK global 3.47
|
||||
```
|
||||
|
||||
Git Bash:
|
||||
|
||||
```bash
|
||||
FVM=~/fvm/versions/3.41.9/bin
|
||||
|
||||
"$FVM/flutter.bat" pub get
|
||||
"$FVM/dart.bat" run build_runner build --delete-conflicting-outputs
|
||||
flutter pub get
|
||||
```
|
||||
|
||||
Durasi normal: **±90–120 detik** untuk full build (146 output).
|
||||
|
||||
Setelah itu jalankan `flutter analyze` untuk memastikan hasil generate bersih.
|
||||
|
||||
---
|
||||
|
||||
## Kenapa harus SDK terpisah?
|
||||
|
||||
Kalau codegen dijalankan dengan Flutter global (3.47 / Dart 3.13), semua builder gagal dengan:
|
||||
|
||||
```
|
||||
W SDK language version 3.13.0 is newer than `analyzer` language version 3.9.0.
|
||||
E freezed on lib/application/.../category_analytic_loader_bloc.dart:
|
||||
Exception: Missing implementation of visitDotShorthandPropertyAccess
|
||||
```
|
||||
|
||||
Rantai penyebabnya:
|
||||
|
||||
1. `freezed 2.5.8` membatasi `analyzer <8.0.0`, jadi pub me-resolve ke **analyzer 7.7.1** (language version 3.9).
|
||||
2. Dart 3.13 memakai sintaks *dot-shorthand* (`.value`) di sumber SDK/framework.
|
||||
3. Analyzer 7.7.1 bisa mem-*parse*-nya tapi belum bisa menuliskannya ke summary → crash saat resolve.
|
||||
4. Semua generator (`freezed`, `json_serializable`, `injectable_generator`, `auto_route_generator`) berbagi analyzer yang sama, jadi semuanya ikut mati — termasuk saat men-generate file lama yang tidak diubah.
|
||||
|
||||
Dart 3.11.5 (Flutter 3.41.9) adalah versi tertinggi yang **masih cocok dengan analyzer 7.7.1** sekaligus memenuhi batas `pubspec.lock` (`dart >=3.11.0-0`).
|
||||
|
||||
---
|
||||
|
||||
## Setup sekali di mesin baru
|
||||
|
||||
```powershell
|
||||
dart pub global activate fvm
|
||||
```
|
||||
|
||||
Tambahkan folder binari pub ke PATH agar perintah `fvm` dikenali:
|
||||
`%LOCALAPPDATA%\Pub\Cache\bin`
|
||||
|
||||
Lalu unduh SDK-nya (±1 GB, sekali saja):
|
||||
|
||||
```powershell
|
||||
fvm install 3.41.9
|
||||
fvm list # verifikasi
|
||||
```
|
||||
|
||||
SDK tersimpan di `%USERPROFILE%\fvm\versions\3.41.9` dan **tidak** mengubah Flutter global.
|
||||
|
||||
> Kita sengaja **tidak** menjalankan `fvm use`, supaya repo tidak punya `.fvmrc`/`.fvm/`
|
||||
> dan IDE tetap memakai Flutter 3.47 untuk menjalankan aplikasi.
|
||||
> Kalau lebih suka pin per-project, jalankan `fvm use 3.41.9` lalu pakai `fvm dart run build_runner ...`,
|
||||
> dan tambahkan `.fvm/` ke `.gitignore`.
|
||||
|
||||
---
|
||||
|
||||
## Perintah harian
|
||||
|
||||
Semua contoh memakai variabel `$FVM` dari bagian TL;DR.
|
||||
|
||||
```powershell
|
||||
# build sekali (paling sering dipakai)
|
||||
& "$FVM\dart.bat" run build_runner build --delete-conflicting-outputs
|
||||
|
||||
# mode watch saat banyak mengubah anotasi
|
||||
& "$FVM\dart.bat" run build_runner watch --delete-conflicting-outputs
|
||||
|
||||
# hanya membersihkan output generated
|
||||
& "$FVM\dart.bat" run build_runner clean
|
||||
```
|
||||
|
||||
Wajib generate ulang setiap kali mengubah/menambah file dengan anotasi:
|
||||
|
||||
| Anotasi | Generator | Output |
|
||||
| --- | --- | --- |
|
||||
| `@freezed` | freezed | `*.freezed.dart` |
|
||||
| `@JsonSerializable` / `fromJson` di DTO | json_serializable | `*.g.dart` |
|
||||
| `@injectable`, `@LazySingleton` | injectable_generator | `lib/injection.config.dart` |
|
||||
| `@RoutePage()` | auto_route_generator | `lib/presentation/router/app_router.gr.dart` |
|
||||
| asset baru di `assets/` | flutter_gen_runner | `lib/presentation/components/assets/assets.gen.dart` |
|
||||
|
||||
### Localization (i18n) — tidak lewat build_runner
|
||||
|
||||
`flutter gen-l10n` memakai tooling Flutter, bukan analyzer, jadi **aman dijalankan dengan Flutter 3.47**:
|
||||
|
||||
```powershell
|
||||
flutter gen-l10n
|
||||
```
|
||||
|
||||
Jalankan setiap kali `lib/l10n/app_id.arb` / `app_en.arb` berubah. Hasilnya: `lib/l10n/app_localizations*.dart`.
|
||||
|
||||
---
|
||||
|
||||
## Aturan penting soal `--delete-conflicting-outputs`
|
||||
|
||||
Flag ini **menghapus dulu** semua file generated (±55 file `*.freezed.dart` / `*.g.dart`) sebelum membuat ulang.
|
||||
Kalau proses dibatalkan di tengah jalan, project akan penuh error karena file-nya sudah hilang.
|
||||
|
||||
Pemulihan (semua file generated ikut ter-commit di git):
|
||||
|
||||
```bash
|
||||
git status --porcelain | grep -E "^ D" | sed 's/^ D //' | while read -r f; do git checkout -- "$f"; done
|
||||
```
|
||||
|
||||
Tips: jangan pipe output build ke `tail`/`head` — outputnya jadi ter-buffer sampai proses selesai,
|
||||
sehingga terlihat seperti *hang* padahal sedang jalan.
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
| Gejala | Penyebab | Solusi |
|
||||
| --- | --- | --- |
|
||||
| `Missing implementation of visitDotShorthandPropertyAccess` | codegen dijalankan dengan Flutter global 3.47 | pakai SDK FVM 3.41.9 |
|
||||
| `Failed to update packages` + dump stack VM | `flutter pub run build_runner` / `fvm spawn ... pub run` | pakai `dart.bat run build_runner`, jangan `flutter pub run` |
|
||||
| Ratusan error “isn't defined” di IDE, file `*.freezed.dart` hilang | build dibatalkan setelah `--delete-conflicting-outputs` | restore lewat `git checkout` (lihat di atas) |
|
||||
| `pub get` gagal / versi paket bergeser | `pubspec.lock` di-resolve oleh SDK berbeda | jalankan `flutter pub get` dengan SDK global setelah codegen selesai |
|
||||
| Build terasa lama di run pertama | asset graph baru dibuat dari nol | wajar, ±90–120 detik; run berikutnya inkremental |
|
||||
|
||||
---
|
||||
|
||||
## Rencana jangka panjang
|
||||
|
||||
Perbaikan permanen = upgrade toolchain codegen supaya jalan native di Dart 3.13:
|
||||
|
||||
- `freezed` 2.5.8 → 3.x, `freezed_annotation` 2.4.x → 3.x
|
||||
- `injectable` 2.x → 3.x, `injectable_generator` 2.7 → 3.x
|
||||
- `auto_route` 9.x → 11.x, `auto_route_generator` 9.x → 10.x
|
||||
- `build_runner` → 2.16.x, `json_serializable` → 6.14.x (analyzer ikut naik ke 13.x)
|
||||
|
||||
Konsekuensinya breaking dan cukup besar, jadi perlu dijadwalkan sendiri:
|
||||
|
||||
- freezed 3 **menghapus** `.map()` / `.when()` / `.maybeWhen()` / `.maybeMap()` → ±49 pemakaian (mayoritas di handler event BLoC) harus diganti pattern matching Dart 3 (`switch`).
|
||||
- ±98 file dengan `@freezed` harus dideklarasikan `abstract class` atau `sealed class`.
|
||||
- Migrasi konfigurasi router (auto_route 11) dan DI (injectable 3).
|
||||
|
||||
Selama migrasi itu belum dikerjakan, gunakan alur FVM di dokumen ini.
|
||||
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<!-- Ganti "app-store-connect" jika perlu: ad-hoc, enterprise, development -->
|
||||
<key>method</key>
|
||||
<string>app-store-connect</string>
|
||||
|
||||
<!-- Team ID dari Apple Developer account -->
|
||||
<key>teamID</key>
|
||||
<string>5TRC3M8UZG</string>
|
||||
|
||||
<!-- Signing style: manual (pakai provisioning profile eksplisit) -->
|
||||
<key>signingStyle</key>
|
||||
<string>manual</string>
|
||||
|
||||
<!-- Provisioning profiles: key = bundle ID, value = nama profile -->
|
||||
<key>provisioningProfiles</key>
|
||||
<dict>
|
||||
<key>com.apskel.enaklo</key>
|
||||
<string>Enaklo Owner App Store</string>
|
||||
</dict>
|
||||
|
||||
<key>stripSwiftSymbols</key>
|
||||
<true/>
|
||||
|
||||
<key>uploadBitcode</key>
|
||||
<false/>
|
||||
|
||||
<key>uploadSymbols</key>
|
||||
<true/>
|
||||
|
||||
<key>compileBitcode</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -21,6 +21,6 @@
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>12.0</string>
|
||||
<string>15.0</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Uncomment this line to define a global platform for your project
|
||||
# platform :ios, '12.0'
|
||||
platform :ios, '15.0'
|
||||
|
||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||
@@ -39,5 +39,13 @@ end
|
||||
post_install do |installer|
|
||||
installer.pods_project.targets.each do |target|
|
||||
flutter_additional_ios_build_settings(target)
|
||||
target.build_configurations.each do |config|
|
||||
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.0'
|
||||
config.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
|
||||
# Disable code signing for all Pod targets — only Runner needs signing
|
||||
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
|
||||
config.build_settings['CODE_SIGNING_REQUIRED'] = 'NO'
|
||||
config.build_settings['CODE_SIGN_IDENTITY'] = ''
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,225 @@
|
||||
PODS:
|
||||
- connectivity_plus (0.0.1):
|
||||
- Flutter
|
||||
- device_info_plus (0.0.1):
|
||||
- Flutter
|
||||
- Firebase/CoreOnly (10.25.0):
|
||||
- FirebaseCore (= 10.25.0)
|
||||
- Firebase/Crashlytics (10.25.0):
|
||||
- Firebase/CoreOnly
|
||||
- FirebaseCrashlytics (~> 10.25.0)
|
||||
- Firebase/Messaging (10.25.0):
|
||||
- Firebase/CoreOnly
|
||||
- FirebaseMessaging (~> 10.25.0)
|
||||
- firebase_core (2.32.0):
|
||||
- Firebase/CoreOnly (= 10.25.0)
|
||||
- Flutter
|
||||
- firebase_crashlytics (3.5.7):
|
||||
- Firebase/Crashlytics (= 10.25.0)
|
||||
- firebase_core
|
||||
- Flutter
|
||||
- firebase_messaging (14.7.10):
|
||||
- Firebase/Messaging (= 10.25.0)
|
||||
- firebase_core
|
||||
- Flutter
|
||||
- FirebaseCore (10.25.0):
|
||||
- FirebaseCoreInternal (~> 10.0)
|
||||
- GoogleUtilities/Environment (~> 7.12)
|
||||
- GoogleUtilities/Logger (~> 7.12)
|
||||
- FirebaseCoreExtension (10.29.0):
|
||||
- FirebaseCore (~> 10.0)
|
||||
- FirebaseCoreInternal (10.29.0):
|
||||
- "GoogleUtilities/NSData+zlib (~> 7.8)"
|
||||
- FirebaseCrashlytics (10.25.0):
|
||||
- FirebaseCore (~> 10.5)
|
||||
- FirebaseInstallations (~> 10.0)
|
||||
- FirebaseRemoteConfigInterop (~> 10.23)
|
||||
- FirebaseSessions (~> 10.5)
|
||||
- GoogleDataTransport (~> 9.2)
|
||||
- GoogleUtilities/Environment (~> 7.8)
|
||||
- nanopb (< 2.30911.0, >= 2.30908.0)
|
||||
- PromisesObjC (~> 2.1)
|
||||
- FirebaseInstallations (10.29.0):
|
||||
- FirebaseCore (~> 10.0)
|
||||
- GoogleUtilities/Environment (~> 7.8)
|
||||
- GoogleUtilities/UserDefaults (~> 7.8)
|
||||
- PromisesObjC (~> 2.1)
|
||||
- FirebaseMessaging (10.25.0):
|
||||
- FirebaseCore (~> 10.0)
|
||||
- FirebaseInstallations (~> 10.0)
|
||||
- GoogleDataTransport (~> 9.3)
|
||||
- GoogleUtilities/AppDelegateSwizzler (~> 7.8)
|
||||
- GoogleUtilities/Environment (~> 7.8)
|
||||
- GoogleUtilities/Reachability (~> 7.8)
|
||||
- GoogleUtilities/UserDefaults (~> 7.8)
|
||||
- nanopb (< 2.30911.0, >= 2.30908.0)
|
||||
- FirebaseRemoteConfigInterop (10.29.0)
|
||||
- FirebaseSessions (10.29.0):
|
||||
- FirebaseCore (~> 10.5)
|
||||
- FirebaseCoreExtension (~> 10.0)
|
||||
- FirebaseInstallations (~> 10.0)
|
||||
- GoogleDataTransport (~> 9.2)
|
||||
- GoogleUtilities/Environment (~> 7.13)
|
||||
- GoogleUtilities/UserDefaults (~> 7.13)
|
||||
- nanopb (< 2.30911.0, >= 2.30908.0)
|
||||
- PromisesSwift (~> 2.1)
|
||||
- Flutter (1.0.0)
|
||||
- flutter_local_notifications (0.0.1):
|
||||
- Flutter
|
||||
- GoogleDataTransport (9.4.1):
|
||||
- GoogleUtilities/Environment (~> 7.7)
|
||||
- nanopb (< 2.30911.0, >= 2.30908.0)
|
||||
- PromisesObjC (< 3.0, >= 1.2)
|
||||
- GoogleUtilities/AppDelegateSwizzler (7.13.3):
|
||||
- GoogleUtilities/Environment
|
||||
- GoogleUtilities/Logger
|
||||
- GoogleUtilities/Network
|
||||
- GoogleUtilities/Privacy
|
||||
- GoogleUtilities/Environment (7.13.3):
|
||||
- GoogleUtilities/Privacy
|
||||
- PromisesObjC (< 3.0, >= 1.2)
|
||||
- GoogleUtilities/Logger (7.13.3):
|
||||
- GoogleUtilities/Environment
|
||||
- GoogleUtilities/Privacy
|
||||
- GoogleUtilities/Network (7.13.3):
|
||||
- GoogleUtilities/Logger
|
||||
- "GoogleUtilities/NSData+zlib"
|
||||
- GoogleUtilities/Privacy
|
||||
- GoogleUtilities/Reachability
|
||||
- "GoogleUtilities/NSData+zlib (7.13.3)":
|
||||
- GoogleUtilities/Privacy
|
||||
- GoogleUtilities/Privacy (7.13.3)
|
||||
- GoogleUtilities/Reachability (7.13.3):
|
||||
- GoogleUtilities/Logger
|
||||
- GoogleUtilities/Privacy
|
||||
- GoogleUtilities/UserDefaults (7.13.3):
|
||||
- GoogleUtilities/Logger
|
||||
- GoogleUtilities/Privacy
|
||||
- image_picker_ios (0.0.1):
|
||||
- Flutter
|
||||
- nanopb (2.30910.0):
|
||||
- nanopb/decode (= 2.30910.0)
|
||||
- nanopb/encode (= 2.30910.0)
|
||||
- nanopb/decode (2.30910.0)
|
||||
- nanopb/encode (2.30910.0)
|
||||
- open_file_ios (0.0.1):
|
||||
- Flutter
|
||||
- package_info_plus (0.4.5):
|
||||
- Flutter
|
||||
- path_provider_foundation (0.0.1):
|
||||
- Flutter
|
||||
- FlutterMacOS
|
||||
- permission_handler_apple (9.3.0):
|
||||
- Flutter
|
||||
- PromisesObjC (2.4.0)
|
||||
- PromisesSwift (2.4.0):
|
||||
- PromisesObjC (= 2.4.0)
|
||||
- shared_preferences_foundation (0.0.1):
|
||||
- Flutter
|
||||
- FlutterMacOS
|
||||
- sqflite_darwin (0.0.4):
|
||||
- Flutter
|
||||
- FlutterMacOS
|
||||
- url_launcher_ios (0.0.1):
|
||||
- Flutter
|
||||
|
||||
DEPENDENCIES:
|
||||
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
|
||||
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
|
||||
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
|
||||
- firebase_crashlytics (from `.symlinks/plugins/firebase_crashlytics/ios`)
|
||||
- firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
|
||||
- Flutter (from `Flutter`)
|
||||
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
|
||||
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
|
||||
- open_file_ios (from `.symlinks/plugins/open_file_ios/ios`)
|
||||
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
|
||||
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
|
||||
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
|
||||
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
|
||||
- sqflite_darwin (from `.symlinks/plugins/sqflite_darwin/darwin`)
|
||||
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
|
||||
|
||||
SPEC REPOS:
|
||||
trunk:
|
||||
- Firebase
|
||||
- FirebaseCore
|
||||
- FirebaseCoreExtension
|
||||
- FirebaseCoreInternal
|
||||
- FirebaseCrashlytics
|
||||
- FirebaseInstallations
|
||||
- FirebaseMessaging
|
||||
- FirebaseRemoteConfigInterop
|
||||
- FirebaseSessions
|
||||
- GoogleDataTransport
|
||||
- GoogleUtilities
|
||||
- nanopb
|
||||
- PromisesObjC
|
||||
- PromisesSwift
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
connectivity_plus:
|
||||
:path: ".symlinks/plugins/connectivity_plus/ios"
|
||||
device_info_plus:
|
||||
:path: ".symlinks/plugins/device_info_plus/ios"
|
||||
firebase_core:
|
||||
:path: ".symlinks/plugins/firebase_core/ios"
|
||||
firebase_crashlytics:
|
||||
:path: ".symlinks/plugins/firebase_crashlytics/ios"
|
||||
firebase_messaging:
|
||||
:path: ".symlinks/plugins/firebase_messaging/ios"
|
||||
Flutter:
|
||||
:path: Flutter
|
||||
flutter_local_notifications:
|
||||
:path: ".symlinks/plugins/flutter_local_notifications/ios"
|
||||
image_picker_ios:
|
||||
:path: ".symlinks/plugins/image_picker_ios/ios"
|
||||
open_file_ios:
|
||||
:path: ".symlinks/plugins/open_file_ios/ios"
|
||||
package_info_plus:
|
||||
:path: ".symlinks/plugins/package_info_plus/ios"
|
||||
path_provider_foundation:
|
||||
:path: ".symlinks/plugins/path_provider_foundation/darwin"
|
||||
permission_handler_apple:
|
||||
:path: ".symlinks/plugins/permission_handler_apple/ios"
|
||||
shared_preferences_foundation:
|
||||
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
|
||||
sqflite_darwin:
|
||||
:path: ".symlinks/plugins/sqflite_darwin/darwin"
|
||||
url_launcher_ios:
|
||||
:path: ".symlinks/plugins/url_launcher_ios/ios"
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
connectivity_plus: 2a701ffec2c0ae28a48cf7540e279787e77c447d
|
||||
device_info_plus: bf2e3232933866d73fe290f2942f2156cdd10342
|
||||
Firebase: 0312a2352584f782ea56f66d91606891d4607f06
|
||||
firebase_core: a626d00494efa398e7c54f25f1454a64c8abf197
|
||||
firebase_crashlytics: 17e856fabec68d993662abaf2f6fe2413f0abece
|
||||
firebase_messaging: 1541105e2a2a6ef8bd869bcc44157d31e82f3a50
|
||||
FirebaseCore: 7ec4d0484817f12c3373955bc87762d96842d483
|
||||
FirebaseCoreExtension: 705ca5b14bf71d2564a0ddc677df1fc86ffa600f
|
||||
FirebaseCoreInternal: df84dd300b561c27d5571684f389bf60b0a5c934
|
||||
FirebaseCrashlytics: 4b96efb0ce73b38b2a85e8b8bd1bd8f63f09d015
|
||||
FirebaseInstallations: 913cf60d0400ebd5d6b63a28b290372ab44590dd
|
||||
FirebaseMessaging: 88950ba9485052891ebe26f6c43a52bb62248952
|
||||
FirebaseRemoteConfigInterop: 6efda51fb5e2f15b16585197e26eaa09574e8a4d
|
||||
FirebaseSessions: dbd14adac65ce996228652c1fc3a3f576bdf3ecc
|
||||
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
|
||||
flutter_local_notifications: df98d66e515e1ca797af436137b4459b160ad8c9
|
||||
GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a
|
||||
GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15
|
||||
image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1
|
||||
nanopb: 438bc412db1928dac798aa6fd75726007be04262
|
||||
open_file_ios: 461db5853723763573e140de3193656f91990d9e
|
||||
package_info_plus: c0502532a26c7662a62a356cebe2692ec5fe4ec4
|
||||
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
|
||||
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
|
||||
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
|
||||
PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851
|
||||
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
|
||||
sqflite_darwin: 5a7236e3b501866c1c9befc6771dfd73ffb8702d
|
||||
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe
|
||||
|
||||
PODFILE CHECKSUM: 5f0fa675e57bf6c9b78950d2f469725f8fefc4a3
|
||||
|
||||
COCOAPODS: 1.16.2
|
||||
@@ -8,12 +8,15 @@
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
|
||||
227E95452FB25185003AAE6C /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 227E95442FB25185003AAE6C /* GoogleService-Info.plist */; };
|
||||
331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; };
|
||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
||||
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
|
||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
|
||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
|
||||
989F8AA016A730C566E93749 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3A6F295F1D6E4BB0819A8681 /* Pods_RunnerTests.framework */; };
|
||||
F18848A41F5DE1108211F920 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B7ABC3D9AD3883EDD2E44FB /* Pods_Runner.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@@ -40,14 +43,22 @@
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
0B9C91DAD8EC48930CF79A70 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = "<group>"; };
|
||||
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
|
||||
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
|
||||
159A415F4811E2794AA4092B /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
|
||||
1CE6759F37E82B0362B2E241 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
|
||||
227E95442FB25185003AAE6C /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
|
||||
331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; };
|
||||
331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
3A6F295F1D6E4BB0819A8681 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
||||
3B7ABC3D9AD3883EDD2E44FB /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
3C70A9D33D5F6D7EAE05A508 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
|
||||
7F8F2B65C01EDDD64346C756 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = "<group>"; };
|
||||
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
|
||||
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
|
||||
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
@@ -55,13 +66,23 @@
|
||||
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
E6E423C7625C032FDEFB6799 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
6BBDF52C0DFCF2DFA69EB9C3 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
989F8AA016A730C566E93749 /* Pods_RunnerTests.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
97C146EB1CF9000F007C117D /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
F18848A41F5DE1108211F920 /* Pods_Runner.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -76,6 +97,15 @@
|
||||
path = RunnerTests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4DBA9259FD070A034AF146BB /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3B7ABC3D9AD3883EDD2E44FB /* Pods_Runner.framework */,
|
||||
3A6F295F1D6E4BB0819A8681 /* Pods_RunnerTests.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9740EEB11CF90186004384FC /* Flutter */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -94,6 +124,8 @@
|
||||
97C146F01CF9000F007C117D /* Runner */,
|
||||
97C146EF1CF9000F007C117D /* Products */,
|
||||
331C8082294A63A400263BE5 /* RunnerTests */,
|
||||
F771B77E516695BE7A4B0AEA /* Pods */,
|
||||
4DBA9259FD070A034AF146BB /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
@@ -109,6 +141,7 @@
|
||||
97C146F01CF9000F007C117D /* Runner */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
227E95442FB25185003AAE6C /* GoogleService-Info.plist */,
|
||||
97C146FA1CF9000F007C117D /* Main.storyboard */,
|
||||
97C146FD1CF9000F007C117D /* Assets.xcassets */,
|
||||
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
|
||||
@@ -121,6 +154,19 @@
|
||||
path = Runner;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
F771B77E516695BE7A4B0AEA /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3C70A9D33D5F6D7EAE05A508 /* Pods-Runner.debug.xcconfig */,
|
||||
1CE6759F37E82B0362B2E241 /* Pods-Runner.release.xcconfig */,
|
||||
159A415F4811E2794AA4092B /* Pods-Runner.profile.xcconfig */,
|
||||
E6E423C7625C032FDEFB6799 /* Pods-RunnerTests.debug.xcconfig */,
|
||||
7F8F2B65C01EDDD64346C756 /* Pods-RunnerTests.release.xcconfig */,
|
||||
0B9C91DAD8EC48930CF79A70 /* Pods-RunnerTests.profile.xcconfig */,
|
||||
);
|
||||
path = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@@ -128,8 +174,10 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */;
|
||||
buildPhases = (
|
||||
81D20024DBE321C19417AE73 /* [CP] Check Pods Manifest.lock */,
|
||||
331C807D294A63A400263BE5 /* Sources */,
|
||||
331C807F294A63A400263BE5 /* Resources */,
|
||||
6BBDF52C0DFCF2DFA69EB9C3 /* Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -145,12 +193,15 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
|
||||
buildPhases = (
|
||||
ACC8E6F2D63F11FFC05DF00A /* [CP] Check Pods Manifest.lock */,
|
||||
9740EEB61CF901F6004384FC /* Run Script */,
|
||||
97C146EA1CF9000F007C117D /* Sources */,
|
||||
97C146EB1CF9000F007C117D /* Frameworks */,
|
||||
97C146EC1CF9000F007C117D /* Resources */,
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||
77740562F72074B1BD58B4C5 /* [CP] Embed Pods Frameworks */,
|
||||
E2768009FD8B9B6235B4E16A /* [CP] Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -214,6 +265,7 @@
|
||||
files = (
|
||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
|
||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
|
||||
227E95452FB25185003AAE6C /* GoogleService-Info.plist in Resources */,
|
||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
|
||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
|
||||
);
|
||||
@@ -238,6 +290,45 @@
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
|
||||
};
|
||||
77740562F72074B1BD58B4C5 /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
81D20024DBE321C19417AE73 /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
9740EEB61CF901F6004384FC /* Run Script */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
@@ -253,6 +344,45 @@
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
|
||||
};
|
||||
ACC8E6F2D63F11FFC05DF00A /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||
"${PODS_ROOT}/Manifest.lock",
|
||||
);
|
||||
name = "[CP] Check Pods Manifest.lock";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
E2768009FD8B9B6235B4E16A /* [CP] Copy Pods Resources */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
|
||||
);
|
||||
name = "[CP] Copy Pods Resources";
|
||||
outputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
@@ -346,7 +476,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SUPPORTED_PLATFORMS = iphoneos;
|
||||
@@ -362,13 +492,15 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = 5TRC3M8UZG;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.apskelOwnerFlutter;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.apskel.enaklo;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_VERSION = 5.0;
|
||||
@@ -378,13 +510,14 @@
|
||||
};
|
||||
331C8088294A63A400263BE5 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = E6E423C7625C032FDEFB6799 /* Pods-RunnerTests.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.apskelOwnerFlutter.RunnerTests;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.apskel.enaklo.RunnerTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
@@ -395,13 +528,14 @@
|
||||
};
|
||||
331C8089294A63A400263BE5 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7F8F2B65C01EDDD64346C756 /* Pods-RunnerTests.release.xcconfig */;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.apskelOwnerFlutter.RunnerTests;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.apskel.enaklo.RunnerTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
|
||||
@@ -410,13 +544,14 @@
|
||||
};
|
||||
331C808A294A63A400263BE5 /* Profile */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 0B9C91DAD8EC48930CF79A70 /* Pods-RunnerTests.profile.xcconfig */;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.apskelOwnerFlutter.RunnerTests;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.apskel.enaklo.RunnerTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
|
||||
@@ -472,7 +607,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
@@ -523,7 +658,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SUPPORTED_PLATFORMS = iphoneos;
|
||||
@@ -541,13 +676,15 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = 5TRC3M8UZG;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.apskelOwnerFlutter;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.apskel.enaklo;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
@@ -563,13 +700,15 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = 5TRC3M8UZG;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.apskelOwnerFlutter;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.apskel.enaklo;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_VERSION = 5.0;
|
||||
|
||||
@@ -4,4 +4,7 @@
|
||||
<FileRef
|
||||
location = "group:Runner.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Pods/Pods.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import Flutter
|
||||
import UIKit
|
||||
import UserNotifications
|
||||
import Firebase
|
||||
|
||||
@main
|
||||
@objc class AppDelegate: FlutterAppDelegate {
|
||||
@@ -7,7 +9,35 @@ import UIKit
|
||||
_ application: UIApplication,
|
||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
||||
) -> Bool {
|
||||
|
||||
FirebaseApp.configure()
|
||||
|
||||
// Set notification delegate so notifications show in foreground & background
|
||||
UNUserNotificationCenter.current().delegate = self
|
||||
|
||||
GeneratedPluginRegistrant.register(with: self)
|
||||
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||
|
||||
return super.application(
|
||||
application,
|
||||
didFinishLaunchingWithOptions: launchOptions
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// Called when a notification is delivered while app is in foreground
|
||||
override func userNotificationCenter(
|
||||
_ center: UNUserNotificationCenter,
|
||||
willPresent notification: UNNotification,
|
||||
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void
|
||||
) {
|
||||
completionHandler([.banner, .badge, .sound])
|
||||
}
|
||||
|
||||
// Called when user taps a notification
|
||||
override func userNotificationCenter(
|
||||
_ center: UNUserNotificationCenter,
|
||||
didReceive response: UNNotificationResponse,
|
||||
withCompletionHandler completionHandler: @escaping () -> Void
|
||||
) {
|
||||
completionHandler()
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 150 KiB After Width: | Height: | Size: 652 KiB |
|
Before Width: | Height: | Size: 678 B After Width: | Height: | Size: 622 B |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.6 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 9.7 KiB |
|
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 20 KiB |
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>API_KEY</key>
|
||||
<string>AIzaSyCb6teTjGKytZmAZc2aMJrpaW484tm93jY</string>
|
||||
<key>GCM_SENDER_ID</key>
|
||||
<string>765730035527</string>
|
||||
<key>PLIST_VERSION</key>
|
||||
<string>1</string>
|
||||
<key>BUNDLE_ID</key>
|
||||
<string>com.apskel.enaklo</string>
|
||||
<key>PROJECT_ID</key>
|
||||
<string>apskel-pos-v2</string>
|
||||
<key>STORAGE_BUCKET</key>
|
||||
<string>apskel-pos-v2.firebasestorage.app</string>
|
||||
<key>IS_ADS_ENABLED</key>
|
||||
<false></false>
|
||||
<key>IS_ANALYTICS_ENABLED</key>
|
||||
<false></false>
|
||||
<key>IS_APPINVITE_ENABLED</key>
|
||||
<true></true>
|
||||
<key>IS_GCM_ENABLED</key>
|
||||
<true></true>
|
||||
<key>IS_SIGNIN_ENABLED</key>
|
||||
<true></true>
|
||||
<key>GOOGLE_APP_ID</key>
|
||||
<string>1:765730035527:ios:c87f91e28b33766e241e62</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -5,7 +5,7 @@
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>Apskel Owner Flutter</string>
|
||||
<string>Grow Food</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
@@ -45,5 +45,11 @@
|
||||
<true/>
|
||||
<key>UIApplicationSupportsIndirectInputEvents</key>
|
||||
<true/>
|
||||
<!-- FCM: enable background fetch & remote notifications -->
|
||||
<key>UIBackgroundModes</key>
|
||||
<array>
|
||||
<string>fetch</string>
|
||||
<string>remote-notification</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>aps-environment</key>
|
||||
<string>development</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1 @@
|
||||
2edd7a931624573eff7b4280d22a7f4e
|
||||
@@ -3,15 +3,15 @@
|
||||
flutter_launcher_icons:
|
||||
android: "launcher_icon"
|
||||
ios: true
|
||||
image_path: "assets/images/logo.png"
|
||||
image_path: "assets/images/ic_launcher.png"
|
||||
remove_alpha_ios: true
|
||||
min_sdk_android: 21 # android min sdk min:16, default 21
|
||||
adaptive_icon_background: "#ffffff"
|
||||
adaptive_icon_foreground: "assets/images/logo.png"
|
||||
adaptive_icon_foreground: "assets/images/ic_launcher.png"
|
||||
web:
|
||||
generate: true
|
||||
image_path: "assets/images/logo.png"
|
||||
image_path: "assets/images/ic_launcher.png"
|
||||
windows:
|
||||
generate: true
|
||||
image_path: "assets/images/logo.png"
|
||||
image_path: "assets/images/ic_launcher.png"
|
||||
icon_size: 48
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
|
||||
import '../../../domain/analytic/analytic.dart';
|
||||
import '../../../domain/analytic/repositories/i_analytic_repository.dart';
|
||||
|
||||
part 'category_analytic_loader_event.dart';
|
||||
part 'category_analytic_loader_state.dart';
|
||||
part 'category_analytic_loader_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class CategoryAnalyticLoaderBloc
|
||||
extends Bloc<CategoryAnalyticLoaderEvent, CategoryAnalyticLoaderState> {
|
||||
final IAnalyticRepository _repository;
|
||||
|
||||
CategoryAnalyticLoaderBloc(this._repository)
|
||||
: super(CategoryAnalyticLoaderState.initial()) {
|
||||
on<CategoryAnalyticLoaderEvent>(_onCategoryAnalyticLoaderEvent);
|
||||
}
|
||||
|
||||
Future<void> _onCategoryAnalyticLoaderEvent(
|
||||
CategoryAnalyticLoaderEvent event,
|
||||
Emitter<CategoryAnalyticLoaderState> emit,
|
||||
) {
|
||||
return event.map(
|
||||
rangeDateChanged: (e) async {
|
||||
emit(state.copyWith(dateFrom: e.dateFrom, dateTo: e.dateTo));
|
||||
},
|
||||
fetched: (e) async {
|
||||
emit(
|
||||
state.copyWith(
|
||||
isFetching: true,
|
||||
failureOptionCategoryAnalytic: none(),
|
||||
),
|
||||
);
|
||||
|
||||
final result = await _repository.getCategory(
|
||||
dateFrom: state.dateFrom,
|
||||
dateTo: state.dateTo,
|
||||
);
|
||||
|
||||
var data = result.fold(
|
||||
(f) => state.copyWith(failureOptionCategoryAnalytic: optionOf(f)),
|
||||
(categoryAnalytic) =>
|
||||
state.copyWith(categoryAnalytic: categoryAnalytic),
|
||||
);
|
||||
|
||||
emit(data.copyWith(isFetching: false));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,621 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'category_analytic_loader_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
|
||||
/// @nodoc
|
||||
mixin _$CategoryAnalyticLoaderEvent {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||
rangeDateChanged,
|
||||
required TResult Function() fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult? Function()? fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult Function()? fetched,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||
required TResult Function(_Fetched value) fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult? Function(_Fetched value)? fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult Function(_Fetched value)? fetched,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $CategoryAnalyticLoaderEventCopyWith<$Res> {
|
||||
factory $CategoryAnalyticLoaderEventCopyWith(
|
||||
CategoryAnalyticLoaderEvent value,
|
||||
$Res Function(CategoryAnalyticLoaderEvent) then,
|
||||
) =
|
||||
_$CategoryAnalyticLoaderEventCopyWithImpl<
|
||||
$Res,
|
||||
CategoryAnalyticLoaderEvent
|
||||
>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$CategoryAnalyticLoaderEventCopyWithImpl<
|
||||
$Res,
|
||||
$Val extends CategoryAnalyticLoaderEvent
|
||||
>
|
||||
implements $CategoryAnalyticLoaderEventCopyWith<$Res> {
|
||||
_$CategoryAnalyticLoaderEventCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of CategoryAnalyticLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$RangeDateChangedImplCopyWith<$Res> {
|
||||
factory _$$RangeDateChangedImplCopyWith(
|
||||
_$RangeDateChangedImpl value,
|
||||
$Res Function(_$RangeDateChangedImpl) then,
|
||||
) = __$$RangeDateChangedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({DateTime dateFrom, DateTime dateTo});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$RangeDateChangedImplCopyWithImpl<$Res>
|
||||
extends
|
||||
_$CategoryAnalyticLoaderEventCopyWithImpl<$Res, _$RangeDateChangedImpl>
|
||||
implements _$$RangeDateChangedImplCopyWith<$Res> {
|
||||
__$$RangeDateChangedImplCopyWithImpl(
|
||||
_$RangeDateChangedImpl _value,
|
||||
$Res Function(_$RangeDateChangedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of CategoryAnalyticLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? dateFrom = null, Object? dateTo = null}) {
|
||||
return _then(
|
||||
_$RangeDateChangedImpl(
|
||||
null == dateFrom
|
||||
? _value.dateFrom
|
||||
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
null == dateTo
|
||||
? _value.dateTo
|
||||
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$RangeDateChangedImpl implements _RangeDateChanged {
|
||||
const _$RangeDateChangedImpl(this.dateFrom, this.dateTo);
|
||||
|
||||
@override
|
||||
final DateTime dateFrom;
|
||||
@override
|
||||
final DateTime dateTo;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CategoryAnalyticLoaderEvent.rangeDateChanged(dateFrom: $dateFrom, dateTo: $dateTo)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$RangeDateChangedImpl &&
|
||||
(identical(other.dateFrom, dateFrom) ||
|
||||
other.dateFrom == dateFrom) &&
|
||||
(identical(other.dateTo, dateTo) || other.dateTo == dateTo));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, dateFrom, dateTo);
|
||||
|
||||
/// Create a copy of CategoryAnalyticLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$RangeDateChangedImplCopyWith<_$RangeDateChangedImpl> get copyWith =>
|
||||
__$$RangeDateChangedImplCopyWithImpl<_$RangeDateChangedImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||
rangeDateChanged,
|
||||
required TResult Function() fetched,
|
||||
}) {
|
||||
return rangeDateChanged(dateFrom, dateTo);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult? Function()? fetched,
|
||||
}) {
|
||||
return rangeDateChanged?.call(dateFrom, dateTo);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult Function()? fetched,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (rangeDateChanged != null) {
|
||||
return rangeDateChanged(dateFrom, dateTo);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||
required TResult Function(_Fetched value) fetched,
|
||||
}) {
|
||||
return rangeDateChanged(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult? Function(_Fetched value)? fetched,
|
||||
}) {
|
||||
return rangeDateChanged?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult Function(_Fetched value)? fetched,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (rangeDateChanged != null) {
|
||||
return rangeDateChanged(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _RangeDateChanged implements CategoryAnalyticLoaderEvent {
|
||||
const factory _RangeDateChanged(
|
||||
final DateTime dateFrom,
|
||||
final DateTime dateTo,
|
||||
) = _$RangeDateChangedImpl;
|
||||
|
||||
DateTime get dateFrom;
|
||||
DateTime get dateTo;
|
||||
|
||||
/// Create a copy of CategoryAnalyticLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$RangeDateChangedImplCopyWith<_$RangeDateChangedImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$FetchedImplCopyWith<$Res> {
|
||||
factory _$$FetchedImplCopyWith(
|
||||
_$FetchedImpl value,
|
||||
$Res Function(_$FetchedImpl) then,
|
||||
) = __$$FetchedImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$FetchedImplCopyWithImpl<$Res>
|
||||
extends _$CategoryAnalyticLoaderEventCopyWithImpl<$Res, _$FetchedImpl>
|
||||
implements _$$FetchedImplCopyWith<$Res> {
|
||||
__$$FetchedImplCopyWithImpl(
|
||||
_$FetchedImpl _value,
|
||||
$Res Function(_$FetchedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of CategoryAnalyticLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$FetchedImpl implements _Fetched {
|
||||
const _$FetchedImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CategoryAnalyticLoaderEvent.fetched()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$FetchedImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||
rangeDateChanged,
|
||||
required TResult Function() fetched,
|
||||
}) {
|
||||
return fetched();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult? Function()? fetched,
|
||||
}) {
|
||||
return fetched?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult Function()? fetched,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (fetched != null) {
|
||||
return fetched();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||
required TResult Function(_Fetched value) fetched,
|
||||
}) {
|
||||
return fetched(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult? Function(_Fetched value)? fetched,
|
||||
}) {
|
||||
return fetched?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult Function(_Fetched value)? fetched,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (fetched != null) {
|
||||
return fetched(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Fetched implements CategoryAnalyticLoaderEvent {
|
||||
const factory _Fetched() = _$FetchedImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$CategoryAnalyticLoaderState {
|
||||
CategoryAnalytic get categoryAnalytic => throw _privateConstructorUsedError;
|
||||
Option<AnalyticFailure> get failureOptionCategoryAnalytic =>
|
||||
throw _privateConstructorUsedError;
|
||||
bool get isFetching => throw _privateConstructorUsedError;
|
||||
DateTime get dateFrom => throw _privateConstructorUsedError;
|
||||
DateTime get dateTo => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of CategoryAnalyticLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$CategoryAnalyticLoaderStateCopyWith<CategoryAnalyticLoaderState>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $CategoryAnalyticLoaderStateCopyWith<$Res> {
|
||||
factory $CategoryAnalyticLoaderStateCopyWith(
|
||||
CategoryAnalyticLoaderState value,
|
||||
$Res Function(CategoryAnalyticLoaderState) then,
|
||||
) =
|
||||
_$CategoryAnalyticLoaderStateCopyWithImpl<
|
||||
$Res,
|
||||
CategoryAnalyticLoaderState
|
||||
>;
|
||||
@useResult
|
||||
$Res call({
|
||||
CategoryAnalytic categoryAnalytic,
|
||||
Option<AnalyticFailure> failureOptionCategoryAnalytic,
|
||||
bool isFetching,
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
});
|
||||
|
||||
$CategoryAnalyticCopyWith<$Res> get categoryAnalytic;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$CategoryAnalyticLoaderStateCopyWithImpl<
|
||||
$Res,
|
||||
$Val extends CategoryAnalyticLoaderState
|
||||
>
|
||||
implements $CategoryAnalyticLoaderStateCopyWith<$Res> {
|
||||
_$CategoryAnalyticLoaderStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of CategoryAnalyticLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? categoryAnalytic = null,
|
||||
Object? failureOptionCategoryAnalytic = null,
|
||||
Object? isFetching = null,
|
||||
Object? dateFrom = null,
|
||||
Object? dateTo = null,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
categoryAnalytic: null == categoryAnalytic
|
||||
? _value.categoryAnalytic
|
||||
: categoryAnalytic // ignore: cast_nullable_to_non_nullable
|
||||
as CategoryAnalytic,
|
||||
failureOptionCategoryAnalytic: null == failureOptionCategoryAnalytic
|
||||
? _value.failureOptionCategoryAnalytic
|
||||
: failureOptionCategoryAnalytic // ignore: cast_nullable_to_non_nullable
|
||||
as Option<AnalyticFailure>,
|
||||
isFetching: null == isFetching
|
||||
? _value.isFetching
|
||||
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
dateFrom: null == dateFrom
|
||||
? _value.dateFrom
|
||||
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
dateTo: null == dateTo
|
||||
? _value.dateTo
|
||||
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
|
||||
/// Create a copy of CategoryAnalyticLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$CategoryAnalyticCopyWith<$Res> get categoryAnalytic {
|
||||
return $CategoryAnalyticCopyWith<$Res>(_value.categoryAnalytic, (value) {
|
||||
return _then(_value.copyWith(categoryAnalytic: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$CategoryAnalyticLoaderStateImplCopyWith<$Res>
|
||||
implements $CategoryAnalyticLoaderStateCopyWith<$Res> {
|
||||
factory _$$CategoryAnalyticLoaderStateImplCopyWith(
|
||||
_$CategoryAnalyticLoaderStateImpl value,
|
||||
$Res Function(_$CategoryAnalyticLoaderStateImpl) then,
|
||||
) = __$$CategoryAnalyticLoaderStateImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
CategoryAnalytic categoryAnalytic,
|
||||
Option<AnalyticFailure> failureOptionCategoryAnalytic,
|
||||
bool isFetching,
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
});
|
||||
|
||||
@override
|
||||
$CategoryAnalyticCopyWith<$Res> get categoryAnalytic;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$CategoryAnalyticLoaderStateImplCopyWithImpl<$Res>
|
||||
extends
|
||||
_$CategoryAnalyticLoaderStateCopyWithImpl<
|
||||
$Res,
|
||||
_$CategoryAnalyticLoaderStateImpl
|
||||
>
|
||||
implements _$$CategoryAnalyticLoaderStateImplCopyWith<$Res> {
|
||||
__$$CategoryAnalyticLoaderStateImplCopyWithImpl(
|
||||
_$CategoryAnalyticLoaderStateImpl _value,
|
||||
$Res Function(_$CategoryAnalyticLoaderStateImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of CategoryAnalyticLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? categoryAnalytic = null,
|
||||
Object? failureOptionCategoryAnalytic = null,
|
||||
Object? isFetching = null,
|
||||
Object? dateFrom = null,
|
||||
Object? dateTo = null,
|
||||
}) {
|
||||
return _then(
|
||||
_$CategoryAnalyticLoaderStateImpl(
|
||||
categoryAnalytic: null == categoryAnalytic
|
||||
? _value.categoryAnalytic
|
||||
: categoryAnalytic // ignore: cast_nullable_to_non_nullable
|
||||
as CategoryAnalytic,
|
||||
failureOptionCategoryAnalytic: null == failureOptionCategoryAnalytic
|
||||
? _value.failureOptionCategoryAnalytic
|
||||
: failureOptionCategoryAnalytic // ignore: cast_nullable_to_non_nullable
|
||||
as Option<AnalyticFailure>,
|
||||
isFetching: null == isFetching
|
||||
? _value.isFetching
|
||||
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
dateFrom: null == dateFrom
|
||||
? _value.dateFrom
|
||||
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
dateTo: null == dateTo
|
||||
? _value.dateTo
|
||||
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$CategoryAnalyticLoaderStateImpl
|
||||
implements _CategoryAnalyticLoaderState {
|
||||
const _$CategoryAnalyticLoaderStateImpl({
|
||||
required this.categoryAnalytic,
|
||||
required this.failureOptionCategoryAnalytic,
|
||||
this.isFetching = false,
|
||||
required this.dateFrom,
|
||||
required this.dateTo,
|
||||
});
|
||||
|
||||
@override
|
||||
final CategoryAnalytic categoryAnalytic;
|
||||
@override
|
||||
final Option<AnalyticFailure> failureOptionCategoryAnalytic;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool isFetching;
|
||||
@override
|
||||
final DateTime dateFrom;
|
||||
@override
|
||||
final DateTime dateTo;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CategoryAnalyticLoaderState(categoryAnalytic: $categoryAnalytic, failureOptionCategoryAnalytic: $failureOptionCategoryAnalytic, isFetching: $isFetching, dateFrom: $dateFrom, dateTo: $dateTo)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$CategoryAnalyticLoaderStateImpl &&
|
||||
(identical(other.categoryAnalytic, categoryAnalytic) ||
|
||||
other.categoryAnalytic == categoryAnalytic) &&
|
||||
(identical(
|
||||
other.failureOptionCategoryAnalytic,
|
||||
failureOptionCategoryAnalytic,
|
||||
) ||
|
||||
other.failureOptionCategoryAnalytic ==
|
||||
failureOptionCategoryAnalytic) &&
|
||||
(identical(other.isFetching, isFetching) ||
|
||||
other.isFetching == isFetching) &&
|
||||
(identical(other.dateFrom, dateFrom) ||
|
||||
other.dateFrom == dateFrom) &&
|
||||
(identical(other.dateTo, dateTo) || other.dateTo == dateTo));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
categoryAnalytic,
|
||||
failureOptionCategoryAnalytic,
|
||||
isFetching,
|
||||
dateFrom,
|
||||
dateTo,
|
||||
);
|
||||
|
||||
/// Create a copy of CategoryAnalyticLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$CategoryAnalyticLoaderStateImplCopyWith<_$CategoryAnalyticLoaderStateImpl>
|
||||
get copyWith =>
|
||||
__$$CategoryAnalyticLoaderStateImplCopyWithImpl<
|
||||
_$CategoryAnalyticLoaderStateImpl
|
||||
>(this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _CategoryAnalyticLoaderState
|
||||
implements CategoryAnalyticLoaderState {
|
||||
const factory _CategoryAnalyticLoaderState({
|
||||
required final CategoryAnalytic categoryAnalytic,
|
||||
required final Option<AnalyticFailure> failureOptionCategoryAnalytic,
|
||||
final bool isFetching,
|
||||
required final DateTime dateFrom,
|
||||
required final DateTime dateTo,
|
||||
}) = _$CategoryAnalyticLoaderStateImpl;
|
||||
|
||||
@override
|
||||
CategoryAnalytic get categoryAnalytic;
|
||||
@override
|
||||
Option<AnalyticFailure> get failureOptionCategoryAnalytic;
|
||||
@override
|
||||
bool get isFetching;
|
||||
@override
|
||||
DateTime get dateFrom;
|
||||
@override
|
||||
DateTime get dateTo;
|
||||
|
||||
/// Create a copy of CategoryAnalyticLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$CategoryAnalyticLoaderStateImplCopyWith<_$CategoryAnalyticLoaderStateImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
part of 'category_analytic_loader_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class CategoryAnalyticLoaderEvent with _$CategoryAnalyticLoaderEvent {
|
||||
const factory CategoryAnalyticLoaderEvent.rangeDateChanged(
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
) = _RangeDateChanged;
|
||||
const factory CategoryAnalyticLoaderEvent.fetched() = _Fetched;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
part of 'category_analytic_loader_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class CategoryAnalyticLoaderState with _$CategoryAnalyticLoaderState {
|
||||
const factory CategoryAnalyticLoaderState({
|
||||
required CategoryAnalytic categoryAnalytic,
|
||||
required Option<AnalyticFailure> failureOptionCategoryAnalytic,
|
||||
@Default(false) bool isFetching,
|
||||
required DateTime dateFrom,
|
||||
required DateTime dateTo,
|
||||
}) = _CategoryAnalyticLoaderState;
|
||||
|
||||
factory CategoryAnalyticLoaderState.initial() => CategoryAnalyticLoaderState(
|
||||
categoryAnalytic: CategoryAnalytic.empty(),
|
||||
failureOptionCategoryAnalytic: none(),
|
||||
dateFrom: DateTime.now(),
|
||||
dateTo: DateTime.now(),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
|
||||
import '../../../domain/analytic/analytic.dart';
|
||||
import '../../../domain/analytic/repositories/i_analytic_repository.dart';
|
||||
|
||||
part 'dashboard_analytic_loader_event.dart';
|
||||
part 'dashboard_analytic_loader_state.dart';
|
||||
part 'dashboard_analytic_loader_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class DashboardAnalyticLoaderBloc
|
||||
extends Bloc<DashboardAnalyticLoaderEvent, DashboardAnalyticLoaderState> {
|
||||
final IAnalyticRepository _repository;
|
||||
DashboardAnalyticLoaderBloc(this._repository)
|
||||
: super(DashboardAnalyticLoaderState.initial()) {
|
||||
on<DashboardAnalyticLoaderEvent>(_onDashboardAnalyticLoaderEvent);
|
||||
}
|
||||
|
||||
Future<void> _onDashboardAnalyticLoaderEvent(
|
||||
DashboardAnalyticLoaderEvent event,
|
||||
Emitter<DashboardAnalyticLoaderState> emit,
|
||||
) {
|
||||
return event.map(
|
||||
rangeDateChanged: (e) async {
|
||||
emit(state.copyWith(dateFrom: e.dateFrom, dateTo: e.dateTo));
|
||||
},
|
||||
fetched: (e) async {
|
||||
emit(
|
||||
state.copyWith(
|
||||
isFetching: true,
|
||||
failureOptionDashboardAnalytic: none(),
|
||||
),
|
||||
);
|
||||
|
||||
final result = await _repository.getDashboard(
|
||||
dateFrom: state.dateFrom,
|
||||
dateTo: state.dateTo,
|
||||
);
|
||||
|
||||
var data = result.fold(
|
||||
(f) => state.copyWith(failureOptionDashboardAnalytic: optionOf(f)),
|
||||
(dashboardAnalytic) =>
|
||||
state.copyWith(dashboardAnalytic: dashboardAnalytic),
|
||||
);
|
||||
|
||||
emit(data.copyWith(isFetching: false));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,626 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'dashboard_analytic_loader_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
|
||||
/// @nodoc
|
||||
mixin _$DashboardAnalyticLoaderEvent {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||
rangeDateChanged,
|
||||
required TResult Function() fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult? Function()? fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult Function()? fetched,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||
required TResult Function(_Fetched value) fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult? Function(_Fetched value)? fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult Function(_Fetched value)? fetched,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $DashboardAnalyticLoaderEventCopyWith<$Res> {
|
||||
factory $DashboardAnalyticLoaderEventCopyWith(
|
||||
DashboardAnalyticLoaderEvent value,
|
||||
$Res Function(DashboardAnalyticLoaderEvent) then,
|
||||
) =
|
||||
_$DashboardAnalyticLoaderEventCopyWithImpl<
|
||||
$Res,
|
||||
DashboardAnalyticLoaderEvent
|
||||
>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$DashboardAnalyticLoaderEventCopyWithImpl<
|
||||
$Res,
|
||||
$Val extends DashboardAnalyticLoaderEvent
|
||||
>
|
||||
implements $DashboardAnalyticLoaderEventCopyWith<$Res> {
|
||||
_$DashboardAnalyticLoaderEventCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of DashboardAnalyticLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$RangeDateChangedImplCopyWith<$Res> {
|
||||
factory _$$RangeDateChangedImplCopyWith(
|
||||
_$RangeDateChangedImpl value,
|
||||
$Res Function(_$RangeDateChangedImpl) then,
|
||||
) = __$$RangeDateChangedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({DateTime dateFrom, DateTime dateTo});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$RangeDateChangedImplCopyWithImpl<$Res>
|
||||
extends
|
||||
_$DashboardAnalyticLoaderEventCopyWithImpl<$Res, _$RangeDateChangedImpl>
|
||||
implements _$$RangeDateChangedImplCopyWith<$Res> {
|
||||
__$$RangeDateChangedImplCopyWithImpl(
|
||||
_$RangeDateChangedImpl _value,
|
||||
$Res Function(_$RangeDateChangedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of DashboardAnalyticLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? dateFrom = null, Object? dateTo = null}) {
|
||||
return _then(
|
||||
_$RangeDateChangedImpl(
|
||||
null == dateFrom
|
||||
? _value.dateFrom
|
||||
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
null == dateTo
|
||||
? _value.dateTo
|
||||
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$RangeDateChangedImpl implements _RangeDateChanged {
|
||||
const _$RangeDateChangedImpl(this.dateFrom, this.dateTo);
|
||||
|
||||
@override
|
||||
final DateTime dateFrom;
|
||||
@override
|
||||
final DateTime dateTo;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'DashboardAnalyticLoaderEvent.rangeDateChanged(dateFrom: $dateFrom, dateTo: $dateTo)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$RangeDateChangedImpl &&
|
||||
(identical(other.dateFrom, dateFrom) ||
|
||||
other.dateFrom == dateFrom) &&
|
||||
(identical(other.dateTo, dateTo) || other.dateTo == dateTo));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, dateFrom, dateTo);
|
||||
|
||||
/// Create a copy of DashboardAnalyticLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$RangeDateChangedImplCopyWith<_$RangeDateChangedImpl> get copyWith =>
|
||||
__$$RangeDateChangedImplCopyWithImpl<_$RangeDateChangedImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||
rangeDateChanged,
|
||||
required TResult Function() fetched,
|
||||
}) {
|
||||
return rangeDateChanged(dateFrom, dateTo);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult? Function()? fetched,
|
||||
}) {
|
||||
return rangeDateChanged?.call(dateFrom, dateTo);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult Function()? fetched,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (rangeDateChanged != null) {
|
||||
return rangeDateChanged(dateFrom, dateTo);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||
required TResult Function(_Fetched value) fetched,
|
||||
}) {
|
||||
return rangeDateChanged(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult? Function(_Fetched value)? fetched,
|
||||
}) {
|
||||
return rangeDateChanged?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult Function(_Fetched value)? fetched,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (rangeDateChanged != null) {
|
||||
return rangeDateChanged(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _RangeDateChanged implements DashboardAnalyticLoaderEvent {
|
||||
const factory _RangeDateChanged(
|
||||
final DateTime dateFrom,
|
||||
final DateTime dateTo,
|
||||
) = _$RangeDateChangedImpl;
|
||||
|
||||
DateTime get dateFrom;
|
||||
DateTime get dateTo;
|
||||
|
||||
/// Create a copy of DashboardAnalyticLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$RangeDateChangedImplCopyWith<_$RangeDateChangedImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$FetchedImplCopyWith<$Res> {
|
||||
factory _$$FetchedImplCopyWith(
|
||||
_$FetchedImpl value,
|
||||
$Res Function(_$FetchedImpl) then,
|
||||
) = __$$FetchedImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$FetchedImplCopyWithImpl<$Res>
|
||||
extends _$DashboardAnalyticLoaderEventCopyWithImpl<$Res, _$FetchedImpl>
|
||||
implements _$$FetchedImplCopyWith<$Res> {
|
||||
__$$FetchedImplCopyWithImpl(
|
||||
_$FetchedImpl _value,
|
||||
$Res Function(_$FetchedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of DashboardAnalyticLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$FetchedImpl implements _Fetched {
|
||||
const _$FetchedImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'DashboardAnalyticLoaderEvent.fetched()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$FetchedImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||
rangeDateChanged,
|
||||
required TResult Function() fetched,
|
||||
}) {
|
||||
return fetched();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult? Function()? fetched,
|
||||
}) {
|
||||
return fetched?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult Function()? fetched,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (fetched != null) {
|
||||
return fetched();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||
required TResult Function(_Fetched value) fetched,
|
||||
}) {
|
||||
return fetched(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult? Function(_Fetched value)? fetched,
|
||||
}) {
|
||||
return fetched?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult Function(_Fetched value)? fetched,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (fetched != null) {
|
||||
return fetched(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Fetched implements DashboardAnalyticLoaderEvent {
|
||||
const factory _Fetched() = _$FetchedImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$DashboardAnalyticLoaderState {
|
||||
DashboardAnalytic get dashboardAnalytic => throw _privateConstructorUsedError;
|
||||
Option<AnalyticFailure> get failureOptionDashboardAnalytic =>
|
||||
throw _privateConstructorUsedError;
|
||||
bool get isFetching => throw _privateConstructorUsedError;
|
||||
DateTime get dateFrom => throw _privateConstructorUsedError;
|
||||
DateTime get dateTo => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of DashboardAnalyticLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$DashboardAnalyticLoaderStateCopyWith<DashboardAnalyticLoaderState>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $DashboardAnalyticLoaderStateCopyWith<$Res> {
|
||||
factory $DashboardAnalyticLoaderStateCopyWith(
|
||||
DashboardAnalyticLoaderState value,
|
||||
$Res Function(DashboardAnalyticLoaderState) then,
|
||||
) =
|
||||
_$DashboardAnalyticLoaderStateCopyWithImpl<
|
||||
$Res,
|
||||
DashboardAnalyticLoaderState
|
||||
>;
|
||||
@useResult
|
||||
$Res call({
|
||||
DashboardAnalytic dashboardAnalytic,
|
||||
Option<AnalyticFailure> failureOptionDashboardAnalytic,
|
||||
bool isFetching,
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
});
|
||||
|
||||
$DashboardAnalyticCopyWith<$Res> get dashboardAnalytic;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$DashboardAnalyticLoaderStateCopyWithImpl<
|
||||
$Res,
|
||||
$Val extends DashboardAnalyticLoaderState
|
||||
>
|
||||
implements $DashboardAnalyticLoaderStateCopyWith<$Res> {
|
||||
_$DashboardAnalyticLoaderStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of DashboardAnalyticLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? dashboardAnalytic = null,
|
||||
Object? failureOptionDashboardAnalytic = null,
|
||||
Object? isFetching = null,
|
||||
Object? dateFrom = null,
|
||||
Object? dateTo = null,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
dashboardAnalytic: null == dashboardAnalytic
|
||||
? _value.dashboardAnalytic
|
||||
: dashboardAnalytic // ignore: cast_nullable_to_non_nullable
|
||||
as DashboardAnalytic,
|
||||
failureOptionDashboardAnalytic:
|
||||
null == failureOptionDashboardAnalytic
|
||||
? _value.failureOptionDashboardAnalytic
|
||||
: failureOptionDashboardAnalytic // ignore: cast_nullable_to_non_nullable
|
||||
as Option<AnalyticFailure>,
|
||||
isFetching: null == isFetching
|
||||
? _value.isFetching
|
||||
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
dateFrom: null == dateFrom
|
||||
? _value.dateFrom
|
||||
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
dateTo: null == dateTo
|
||||
? _value.dateTo
|
||||
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
|
||||
/// Create a copy of DashboardAnalyticLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$DashboardAnalyticCopyWith<$Res> get dashboardAnalytic {
|
||||
return $DashboardAnalyticCopyWith<$Res>(_value.dashboardAnalytic, (value) {
|
||||
return _then(_value.copyWith(dashboardAnalytic: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$DashboardAnalyticLoaderStateImplCopyWith<$Res>
|
||||
implements $DashboardAnalyticLoaderStateCopyWith<$Res> {
|
||||
factory _$$DashboardAnalyticLoaderStateImplCopyWith(
|
||||
_$DashboardAnalyticLoaderStateImpl value,
|
||||
$Res Function(_$DashboardAnalyticLoaderStateImpl) then,
|
||||
) = __$$DashboardAnalyticLoaderStateImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
DashboardAnalytic dashboardAnalytic,
|
||||
Option<AnalyticFailure> failureOptionDashboardAnalytic,
|
||||
bool isFetching,
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
});
|
||||
|
||||
@override
|
||||
$DashboardAnalyticCopyWith<$Res> get dashboardAnalytic;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$DashboardAnalyticLoaderStateImplCopyWithImpl<$Res>
|
||||
extends
|
||||
_$DashboardAnalyticLoaderStateCopyWithImpl<
|
||||
$Res,
|
||||
_$DashboardAnalyticLoaderStateImpl
|
||||
>
|
||||
implements _$$DashboardAnalyticLoaderStateImplCopyWith<$Res> {
|
||||
__$$DashboardAnalyticLoaderStateImplCopyWithImpl(
|
||||
_$DashboardAnalyticLoaderStateImpl _value,
|
||||
$Res Function(_$DashboardAnalyticLoaderStateImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of DashboardAnalyticLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? dashboardAnalytic = null,
|
||||
Object? failureOptionDashboardAnalytic = null,
|
||||
Object? isFetching = null,
|
||||
Object? dateFrom = null,
|
||||
Object? dateTo = null,
|
||||
}) {
|
||||
return _then(
|
||||
_$DashboardAnalyticLoaderStateImpl(
|
||||
dashboardAnalytic: null == dashboardAnalytic
|
||||
? _value.dashboardAnalytic
|
||||
: dashboardAnalytic // ignore: cast_nullable_to_non_nullable
|
||||
as DashboardAnalytic,
|
||||
failureOptionDashboardAnalytic: null == failureOptionDashboardAnalytic
|
||||
? _value.failureOptionDashboardAnalytic
|
||||
: failureOptionDashboardAnalytic // ignore: cast_nullable_to_non_nullable
|
||||
as Option<AnalyticFailure>,
|
||||
isFetching: null == isFetching
|
||||
? _value.isFetching
|
||||
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
dateFrom: null == dateFrom
|
||||
? _value.dateFrom
|
||||
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
dateTo: null == dateTo
|
||||
? _value.dateTo
|
||||
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$DashboardAnalyticLoaderStateImpl
|
||||
implements _DashboardAnalyticLoaderState {
|
||||
const _$DashboardAnalyticLoaderStateImpl({
|
||||
required this.dashboardAnalytic,
|
||||
required this.failureOptionDashboardAnalytic,
|
||||
this.isFetching = false,
|
||||
required this.dateFrom,
|
||||
required this.dateTo,
|
||||
});
|
||||
|
||||
@override
|
||||
final DashboardAnalytic dashboardAnalytic;
|
||||
@override
|
||||
final Option<AnalyticFailure> failureOptionDashboardAnalytic;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool isFetching;
|
||||
@override
|
||||
final DateTime dateFrom;
|
||||
@override
|
||||
final DateTime dateTo;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'DashboardAnalyticLoaderState(dashboardAnalytic: $dashboardAnalytic, failureOptionDashboardAnalytic: $failureOptionDashboardAnalytic, isFetching: $isFetching, dateFrom: $dateFrom, dateTo: $dateTo)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$DashboardAnalyticLoaderStateImpl &&
|
||||
(identical(other.dashboardAnalytic, dashboardAnalytic) ||
|
||||
other.dashboardAnalytic == dashboardAnalytic) &&
|
||||
(identical(
|
||||
other.failureOptionDashboardAnalytic,
|
||||
failureOptionDashboardAnalytic,
|
||||
) ||
|
||||
other.failureOptionDashboardAnalytic ==
|
||||
failureOptionDashboardAnalytic) &&
|
||||
(identical(other.isFetching, isFetching) ||
|
||||
other.isFetching == isFetching) &&
|
||||
(identical(other.dateFrom, dateFrom) ||
|
||||
other.dateFrom == dateFrom) &&
|
||||
(identical(other.dateTo, dateTo) || other.dateTo == dateTo));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
dashboardAnalytic,
|
||||
failureOptionDashboardAnalytic,
|
||||
isFetching,
|
||||
dateFrom,
|
||||
dateTo,
|
||||
);
|
||||
|
||||
/// Create a copy of DashboardAnalyticLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$DashboardAnalyticLoaderStateImplCopyWith<
|
||||
_$DashboardAnalyticLoaderStateImpl
|
||||
>
|
||||
get copyWith =>
|
||||
__$$DashboardAnalyticLoaderStateImplCopyWithImpl<
|
||||
_$DashboardAnalyticLoaderStateImpl
|
||||
>(this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _DashboardAnalyticLoaderState
|
||||
implements DashboardAnalyticLoaderState {
|
||||
const factory _DashboardAnalyticLoaderState({
|
||||
required final DashboardAnalytic dashboardAnalytic,
|
||||
required final Option<AnalyticFailure> failureOptionDashboardAnalytic,
|
||||
final bool isFetching,
|
||||
required final DateTime dateFrom,
|
||||
required final DateTime dateTo,
|
||||
}) = _$DashboardAnalyticLoaderStateImpl;
|
||||
|
||||
@override
|
||||
DashboardAnalytic get dashboardAnalytic;
|
||||
@override
|
||||
Option<AnalyticFailure> get failureOptionDashboardAnalytic;
|
||||
@override
|
||||
bool get isFetching;
|
||||
@override
|
||||
DateTime get dateFrom;
|
||||
@override
|
||||
DateTime get dateTo;
|
||||
|
||||
/// Create a copy of DashboardAnalyticLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$DashboardAnalyticLoaderStateImplCopyWith<
|
||||
_$DashboardAnalyticLoaderStateImpl
|
||||
>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
part of 'dashboard_analytic_loader_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class DashboardAnalyticLoaderEvent with _$DashboardAnalyticLoaderEvent {
|
||||
const factory DashboardAnalyticLoaderEvent.rangeDateChanged(
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
) = _RangeDateChanged;
|
||||
const factory DashboardAnalyticLoaderEvent.fetched() = _Fetched;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
part of 'dashboard_analytic_loader_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class DashboardAnalyticLoaderState with _$DashboardAnalyticLoaderState {
|
||||
const factory DashboardAnalyticLoaderState({
|
||||
required DashboardAnalytic dashboardAnalytic,
|
||||
required Option<AnalyticFailure> failureOptionDashboardAnalytic,
|
||||
@Default(false) bool isFetching,
|
||||
required DateTime dateFrom,
|
||||
required DateTime dateTo,
|
||||
}) = _DashboardAnalyticLoaderState;
|
||||
|
||||
factory DashboardAnalyticLoaderState.initial() =>
|
||||
DashboardAnalyticLoaderState(
|
||||
dashboardAnalytic: DashboardAnalytic.empty(),
|
||||
failureOptionDashboardAnalytic: none(),
|
||||
dateFrom: DateTime.now(),
|
||||
dateTo: DateTime.now(),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
|
||||
import '../../../domain/analytic/analytic.dart';
|
||||
import '../../../domain/analytic/repositories/i_analytic_repository.dart';
|
||||
|
||||
part 'exclusive_summary_loader_event.dart';
|
||||
part 'exclusive_summary_loader_state.dart';
|
||||
part 'exclusive_summary_loader_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class ExclusiveSummaryLoaderBloc
|
||||
extends Bloc<ExclusiveSummaryLoaderEvent, ExclusiveSummaryLoaderState> {
|
||||
final IAnalyticRepository _repository;
|
||||
|
||||
ExclusiveSummaryLoaderBloc(this._repository)
|
||||
: super(ExclusiveSummaryLoaderState.initial()) {
|
||||
on<ExclusiveSummaryLoaderEvent>(_onEvent);
|
||||
}
|
||||
|
||||
Future<void> _onEvent(
|
||||
ExclusiveSummaryLoaderEvent event,
|
||||
Emitter<ExclusiveSummaryLoaderState> emit,
|
||||
) {
|
||||
return event.map(
|
||||
rangeDateChanged: (e) async {
|
||||
emit(state.copyWith(dateFrom: e.dateFrom, dateTo: e.dateTo));
|
||||
},
|
||||
fetched: (e) async {
|
||||
emit(
|
||||
state.copyWith(
|
||||
isFetching: true,
|
||||
failureOption: none(),
|
||||
),
|
||||
);
|
||||
|
||||
final result = await _repository.getExclusiveSummary(
|
||||
dateFrom: state.dateFrom,
|
||||
dateTo: state.dateTo,
|
||||
);
|
||||
|
||||
final data = result.fold(
|
||||
(f) => state.copyWith(failureOption: optionOf(f)),
|
||||
(summary) => state.copyWith(exclusiveSummary: summary),
|
||||
);
|
||||
|
||||
emit(data.copyWith(isFetching: false));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,617 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'exclusive_summary_loader_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ExclusiveSummaryLoaderEvent {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||
rangeDateChanged,
|
||||
required TResult Function() fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult? Function()? fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult Function()? fetched,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||
required TResult Function(_Fetched value) fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult? Function(_Fetched value)? fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult Function(_Fetched value)? fetched,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $ExclusiveSummaryLoaderEventCopyWith<$Res> {
|
||||
factory $ExclusiveSummaryLoaderEventCopyWith(
|
||||
ExclusiveSummaryLoaderEvent value,
|
||||
$Res Function(ExclusiveSummaryLoaderEvent) then,
|
||||
) =
|
||||
_$ExclusiveSummaryLoaderEventCopyWithImpl<
|
||||
$Res,
|
||||
ExclusiveSummaryLoaderEvent
|
||||
>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$ExclusiveSummaryLoaderEventCopyWithImpl<
|
||||
$Res,
|
||||
$Val extends ExclusiveSummaryLoaderEvent
|
||||
>
|
||||
implements $ExclusiveSummaryLoaderEventCopyWith<$Res> {
|
||||
_$ExclusiveSummaryLoaderEventCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of ExclusiveSummaryLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$RangeDateChangedImplCopyWith<$Res> {
|
||||
factory _$$RangeDateChangedImplCopyWith(
|
||||
_$RangeDateChangedImpl value,
|
||||
$Res Function(_$RangeDateChangedImpl) then,
|
||||
) = __$$RangeDateChangedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({DateTime dateFrom, DateTime dateTo});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$RangeDateChangedImplCopyWithImpl<$Res>
|
||||
extends
|
||||
_$ExclusiveSummaryLoaderEventCopyWithImpl<$Res, _$RangeDateChangedImpl>
|
||||
implements _$$RangeDateChangedImplCopyWith<$Res> {
|
||||
__$$RangeDateChangedImplCopyWithImpl(
|
||||
_$RangeDateChangedImpl _value,
|
||||
$Res Function(_$RangeDateChangedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of ExclusiveSummaryLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? dateFrom = null, Object? dateTo = null}) {
|
||||
return _then(
|
||||
_$RangeDateChangedImpl(
|
||||
null == dateFrom
|
||||
? _value.dateFrom
|
||||
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
null == dateTo
|
||||
? _value.dateTo
|
||||
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$RangeDateChangedImpl implements _RangeDateChanged {
|
||||
const _$RangeDateChangedImpl(this.dateFrom, this.dateTo);
|
||||
|
||||
@override
|
||||
final DateTime dateFrom;
|
||||
@override
|
||||
final DateTime dateTo;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ExclusiveSummaryLoaderEvent.rangeDateChanged(dateFrom: $dateFrom, dateTo: $dateTo)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$RangeDateChangedImpl &&
|
||||
(identical(other.dateFrom, dateFrom) ||
|
||||
other.dateFrom == dateFrom) &&
|
||||
(identical(other.dateTo, dateTo) || other.dateTo == dateTo));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, dateFrom, dateTo);
|
||||
|
||||
/// Create a copy of ExclusiveSummaryLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$RangeDateChangedImplCopyWith<_$RangeDateChangedImpl> get copyWith =>
|
||||
__$$RangeDateChangedImplCopyWithImpl<_$RangeDateChangedImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||
rangeDateChanged,
|
||||
required TResult Function() fetched,
|
||||
}) {
|
||||
return rangeDateChanged(dateFrom, dateTo);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult? Function()? fetched,
|
||||
}) {
|
||||
return rangeDateChanged?.call(dateFrom, dateTo);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult Function()? fetched,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (rangeDateChanged != null) {
|
||||
return rangeDateChanged(dateFrom, dateTo);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||
required TResult Function(_Fetched value) fetched,
|
||||
}) {
|
||||
return rangeDateChanged(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult? Function(_Fetched value)? fetched,
|
||||
}) {
|
||||
return rangeDateChanged?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult Function(_Fetched value)? fetched,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (rangeDateChanged != null) {
|
||||
return rangeDateChanged(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _RangeDateChanged implements ExclusiveSummaryLoaderEvent {
|
||||
const factory _RangeDateChanged(
|
||||
final DateTime dateFrom,
|
||||
final DateTime dateTo,
|
||||
) = _$RangeDateChangedImpl;
|
||||
|
||||
DateTime get dateFrom;
|
||||
DateTime get dateTo;
|
||||
|
||||
/// Create a copy of ExclusiveSummaryLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$RangeDateChangedImplCopyWith<_$RangeDateChangedImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$FetchedImplCopyWith<$Res> {
|
||||
factory _$$FetchedImplCopyWith(
|
||||
_$FetchedImpl value,
|
||||
$Res Function(_$FetchedImpl) then,
|
||||
) = __$$FetchedImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$FetchedImplCopyWithImpl<$Res>
|
||||
extends _$ExclusiveSummaryLoaderEventCopyWithImpl<$Res, _$FetchedImpl>
|
||||
implements _$$FetchedImplCopyWith<$Res> {
|
||||
__$$FetchedImplCopyWithImpl(
|
||||
_$FetchedImpl _value,
|
||||
$Res Function(_$FetchedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of ExclusiveSummaryLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$FetchedImpl implements _Fetched {
|
||||
const _$FetchedImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ExclusiveSummaryLoaderEvent.fetched()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$FetchedImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||
rangeDateChanged,
|
||||
required TResult Function() fetched,
|
||||
}) {
|
||||
return fetched();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult? Function()? fetched,
|
||||
}) {
|
||||
return fetched?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult Function()? fetched,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (fetched != null) {
|
||||
return fetched();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||
required TResult Function(_Fetched value) fetched,
|
||||
}) {
|
||||
return fetched(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult? Function(_Fetched value)? fetched,
|
||||
}) {
|
||||
return fetched?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult Function(_Fetched value)? fetched,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (fetched != null) {
|
||||
return fetched(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Fetched implements ExclusiveSummaryLoaderEvent {
|
||||
const factory _Fetched() = _$FetchedImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ExclusiveSummaryLoaderState {
|
||||
ExclusiveSummary get exclusiveSummary => throw _privateConstructorUsedError;
|
||||
Option<AnalyticFailure> get failureOption =>
|
||||
throw _privateConstructorUsedError;
|
||||
bool get isFetching => throw _privateConstructorUsedError;
|
||||
DateTime get dateFrom => throw _privateConstructorUsedError;
|
||||
DateTime get dateTo => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of ExclusiveSummaryLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$ExclusiveSummaryLoaderStateCopyWith<ExclusiveSummaryLoaderState>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $ExclusiveSummaryLoaderStateCopyWith<$Res> {
|
||||
factory $ExclusiveSummaryLoaderStateCopyWith(
|
||||
ExclusiveSummaryLoaderState value,
|
||||
$Res Function(ExclusiveSummaryLoaderState) then,
|
||||
) =
|
||||
_$ExclusiveSummaryLoaderStateCopyWithImpl<
|
||||
$Res,
|
||||
ExclusiveSummaryLoaderState
|
||||
>;
|
||||
@useResult
|
||||
$Res call({
|
||||
ExclusiveSummary exclusiveSummary,
|
||||
Option<AnalyticFailure> failureOption,
|
||||
bool isFetching,
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
});
|
||||
|
||||
$ExclusiveSummaryCopyWith<$Res> get exclusiveSummary;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$ExclusiveSummaryLoaderStateCopyWithImpl<
|
||||
$Res,
|
||||
$Val extends ExclusiveSummaryLoaderState
|
||||
>
|
||||
implements $ExclusiveSummaryLoaderStateCopyWith<$Res> {
|
||||
_$ExclusiveSummaryLoaderStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of ExclusiveSummaryLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? exclusiveSummary = null,
|
||||
Object? failureOption = null,
|
||||
Object? isFetching = null,
|
||||
Object? dateFrom = null,
|
||||
Object? dateTo = null,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
exclusiveSummary: null == exclusiveSummary
|
||||
? _value.exclusiveSummary
|
||||
: exclusiveSummary // ignore: cast_nullable_to_non_nullable
|
||||
as ExclusiveSummary,
|
||||
failureOption: null == failureOption
|
||||
? _value.failureOption
|
||||
: failureOption // ignore: cast_nullable_to_non_nullable
|
||||
as Option<AnalyticFailure>,
|
||||
isFetching: null == isFetching
|
||||
? _value.isFetching
|
||||
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
dateFrom: null == dateFrom
|
||||
? _value.dateFrom
|
||||
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
dateTo: null == dateTo
|
||||
? _value.dateTo
|
||||
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
|
||||
/// Create a copy of ExclusiveSummaryLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$ExclusiveSummaryCopyWith<$Res> get exclusiveSummary {
|
||||
return $ExclusiveSummaryCopyWith<$Res>(_value.exclusiveSummary, (value) {
|
||||
return _then(_value.copyWith(exclusiveSummary: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ExclusiveSummaryLoaderStateImplCopyWith<$Res>
|
||||
implements $ExclusiveSummaryLoaderStateCopyWith<$Res> {
|
||||
factory _$$ExclusiveSummaryLoaderStateImplCopyWith(
|
||||
_$ExclusiveSummaryLoaderStateImpl value,
|
||||
$Res Function(_$ExclusiveSummaryLoaderStateImpl) then,
|
||||
) = __$$ExclusiveSummaryLoaderStateImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
ExclusiveSummary exclusiveSummary,
|
||||
Option<AnalyticFailure> failureOption,
|
||||
bool isFetching,
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
});
|
||||
|
||||
@override
|
||||
$ExclusiveSummaryCopyWith<$Res> get exclusiveSummary;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ExclusiveSummaryLoaderStateImplCopyWithImpl<$Res>
|
||||
extends
|
||||
_$ExclusiveSummaryLoaderStateCopyWithImpl<
|
||||
$Res,
|
||||
_$ExclusiveSummaryLoaderStateImpl
|
||||
>
|
||||
implements _$$ExclusiveSummaryLoaderStateImplCopyWith<$Res> {
|
||||
__$$ExclusiveSummaryLoaderStateImplCopyWithImpl(
|
||||
_$ExclusiveSummaryLoaderStateImpl _value,
|
||||
$Res Function(_$ExclusiveSummaryLoaderStateImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of ExclusiveSummaryLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? exclusiveSummary = null,
|
||||
Object? failureOption = null,
|
||||
Object? isFetching = null,
|
||||
Object? dateFrom = null,
|
||||
Object? dateTo = null,
|
||||
}) {
|
||||
return _then(
|
||||
_$ExclusiveSummaryLoaderStateImpl(
|
||||
exclusiveSummary: null == exclusiveSummary
|
||||
? _value.exclusiveSummary
|
||||
: exclusiveSummary // ignore: cast_nullable_to_non_nullable
|
||||
as ExclusiveSummary,
|
||||
failureOption: null == failureOption
|
||||
? _value.failureOption
|
||||
: failureOption // ignore: cast_nullable_to_non_nullable
|
||||
as Option<AnalyticFailure>,
|
||||
isFetching: null == isFetching
|
||||
? _value.isFetching
|
||||
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
dateFrom: null == dateFrom
|
||||
? _value.dateFrom
|
||||
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
dateTo: null == dateTo
|
||||
? _value.dateTo
|
||||
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$ExclusiveSummaryLoaderStateImpl
|
||||
implements _ExclusiveSummaryLoaderState {
|
||||
const _$ExclusiveSummaryLoaderStateImpl({
|
||||
required this.exclusiveSummary,
|
||||
required this.failureOption,
|
||||
this.isFetching = false,
|
||||
required this.dateFrom,
|
||||
required this.dateTo,
|
||||
});
|
||||
|
||||
@override
|
||||
final ExclusiveSummary exclusiveSummary;
|
||||
@override
|
||||
final Option<AnalyticFailure> failureOption;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool isFetching;
|
||||
@override
|
||||
final DateTime dateFrom;
|
||||
@override
|
||||
final DateTime dateTo;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ExclusiveSummaryLoaderState(exclusiveSummary: $exclusiveSummary, failureOption: $failureOption, isFetching: $isFetching, dateFrom: $dateFrom, dateTo: $dateTo)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ExclusiveSummaryLoaderStateImpl &&
|
||||
(identical(other.exclusiveSummary, exclusiveSummary) ||
|
||||
other.exclusiveSummary == exclusiveSummary) &&
|
||||
(identical(other.failureOption, failureOption) ||
|
||||
other.failureOption == failureOption) &&
|
||||
(identical(other.isFetching, isFetching) ||
|
||||
other.isFetching == isFetching) &&
|
||||
(identical(other.dateFrom, dateFrom) ||
|
||||
other.dateFrom == dateFrom) &&
|
||||
(identical(other.dateTo, dateTo) || other.dateTo == dateTo));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
exclusiveSummary,
|
||||
failureOption,
|
||||
isFetching,
|
||||
dateFrom,
|
||||
dateTo,
|
||||
);
|
||||
|
||||
/// Create a copy of ExclusiveSummaryLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$ExclusiveSummaryLoaderStateImplCopyWith<_$ExclusiveSummaryLoaderStateImpl>
|
||||
get copyWith =>
|
||||
__$$ExclusiveSummaryLoaderStateImplCopyWithImpl<
|
||||
_$ExclusiveSummaryLoaderStateImpl
|
||||
>(this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _ExclusiveSummaryLoaderState
|
||||
implements ExclusiveSummaryLoaderState {
|
||||
const factory _ExclusiveSummaryLoaderState({
|
||||
required final ExclusiveSummary exclusiveSummary,
|
||||
required final Option<AnalyticFailure> failureOption,
|
||||
final bool isFetching,
|
||||
required final DateTime dateFrom,
|
||||
required final DateTime dateTo,
|
||||
}) = _$ExclusiveSummaryLoaderStateImpl;
|
||||
|
||||
@override
|
||||
ExclusiveSummary get exclusiveSummary;
|
||||
@override
|
||||
Option<AnalyticFailure> get failureOption;
|
||||
@override
|
||||
bool get isFetching;
|
||||
@override
|
||||
DateTime get dateFrom;
|
||||
@override
|
||||
DateTime get dateTo;
|
||||
|
||||
/// Create a copy of ExclusiveSummaryLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$ExclusiveSummaryLoaderStateImplCopyWith<_$ExclusiveSummaryLoaderStateImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
part of 'exclusive_summary_loader_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class ExclusiveSummaryLoaderEvent with _$ExclusiveSummaryLoaderEvent {
|
||||
const factory ExclusiveSummaryLoaderEvent.rangeDateChanged(
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
) = _RangeDateChanged;
|
||||
|
||||
const factory ExclusiveSummaryLoaderEvent.fetched() = _Fetched;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
part of 'exclusive_summary_loader_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class ExclusiveSummaryLoaderState with _$ExclusiveSummaryLoaderState {
|
||||
const factory ExclusiveSummaryLoaderState({
|
||||
required ExclusiveSummary exclusiveSummary,
|
||||
required Option<AnalyticFailure> failureOption,
|
||||
@Default(false) bool isFetching,
|
||||
required DateTime dateFrom,
|
||||
required DateTime dateTo,
|
||||
}) = _ExclusiveSummaryLoaderState;
|
||||
|
||||
factory ExclusiveSummaryLoaderState.initial() {
|
||||
final now = DateTime.now();
|
||||
return ExclusiveSummaryLoaderState(
|
||||
exclusiveSummary: ExclusiveSummary.empty(),
|
||||
failureOption: none(),
|
||||
dateFrom: DateTime(now.year, now.month, 1),
|
||||
dateTo: DateTime(now.year, now.month + 1, 0),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
|
||||
import '../../../domain/analytic/analytic.dart';
|
||||
import '../../../domain/analytic/repositories/i_analytic_repository.dart';
|
||||
|
||||
part 'inventory_analytic_loader_event.dart';
|
||||
part 'inventory_analytic_loader_state.dart';
|
||||
part 'inventory_analytic_loader_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class InventoryAnalyticLoaderBloc
|
||||
extends Bloc<InventoryAnalyticLoaderEvent, InventoryAnalyticLoaderState> {
|
||||
final IAnalyticRepository _repository;
|
||||
InventoryAnalyticLoaderBloc(this._repository)
|
||||
: super(InventoryAnalyticLoaderState.initial()) {
|
||||
on<InventoryAnalyticLoaderEvent>(_onInventoryAnalyticLoaderEvent);
|
||||
}
|
||||
|
||||
Future<void> _onInventoryAnalyticLoaderEvent(
|
||||
InventoryAnalyticLoaderEvent event,
|
||||
Emitter<InventoryAnalyticLoaderState> emit,
|
||||
) {
|
||||
return event.map(
|
||||
rangeDateChanged: (e) async {
|
||||
emit(state.copyWith(dateFrom: e.dateFrom, dateTo: e.dateTo));
|
||||
},
|
||||
fetched: (e) async {
|
||||
emit(
|
||||
state.copyWith(
|
||||
isFetching: true,
|
||||
failureOptionInventoryAnalytic: none(),
|
||||
),
|
||||
);
|
||||
|
||||
final result = await _repository.getInventory(
|
||||
dateFrom: state.dateFrom,
|
||||
dateTo: state.dateTo,
|
||||
);
|
||||
|
||||
var data = result.fold(
|
||||
(f) => state.copyWith(failureOptionInventoryAnalytic: optionOf(f)),
|
||||
(inventoryAnalytic) =>
|
||||
state.copyWith(inventoryAnalytic: inventoryAnalytic),
|
||||
);
|
||||
|
||||
emit(data.copyWith(isFetching: false));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,626 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'inventory_analytic_loader_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
|
||||
/// @nodoc
|
||||
mixin _$InventoryAnalyticLoaderEvent {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||
rangeDateChanged,
|
||||
required TResult Function() fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult? Function()? fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult Function()? fetched,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||
required TResult Function(_Fetched value) fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult? Function(_Fetched value)? fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult Function(_Fetched value)? fetched,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $InventoryAnalyticLoaderEventCopyWith<$Res> {
|
||||
factory $InventoryAnalyticLoaderEventCopyWith(
|
||||
InventoryAnalyticLoaderEvent value,
|
||||
$Res Function(InventoryAnalyticLoaderEvent) then,
|
||||
) =
|
||||
_$InventoryAnalyticLoaderEventCopyWithImpl<
|
||||
$Res,
|
||||
InventoryAnalyticLoaderEvent
|
||||
>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$InventoryAnalyticLoaderEventCopyWithImpl<
|
||||
$Res,
|
||||
$Val extends InventoryAnalyticLoaderEvent
|
||||
>
|
||||
implements $InventoryAnalyticLoaderEventCopyWith<$Res> {
|
||||
_$InventoryAnalyticLoaderEventCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of InventoryAnalyticLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$RangeDateChangedImplCopyWith<$Res> {
|
||||
factory _$$RangeDateChangedImplCopyWith(
|
||||
_$RangeDateChangedImpl value,
|
||||
$Res Function(_$RangeDateChangedImpl) then,
|
||||
) = __$$RangeDateChangedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({DateTime dateFrom, DateTime dateTo});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$RangeDateChangedImplCopyWithImpl<$Res>
|
||||
extends
|
||||
_$InventoryAnalyticLoaderEventCopyWithImpl<$Res, _$RangeDateChangedImpl>
|
||||
implements _$$RangeDateChangedImplCopyWith<$Res> {
|
||||
__$$RangeDateChangedImplCopyWithImpl(
|
||||
_$RangeDateChangedImpl _value,
|
||||
$Res Function(_$RangeDateChangedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of InventoryAnalyticLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? dateFrom = null, Object? dateTo = null}) {
|
||||
return _then(
|
||||
_$RangeDateChangedImpl(
|
||||
null == dateFrom
|
||||
? _value.dateFrom
|
||||
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
null == dateTo
|
||||
? _value.dateTo
|
||||
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$RangeDateChangedImpl implements _RangeDateChanged {
|
||||
const _$RangeDateChangedImpl(this.dateFrom, this.dateTo);
|
||||
|
||||
@override
|
||||
final DateTime dateFrom;
|
||||
@override
|
||||
final DateTime dateTo;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'InventoryAnalyticLoaderEvent.rangeDateChanged(dateFrom: $dateFrom, dateTo: $dateTo)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$RangeDateChangedImpl &&
|
||||
(identical(other.dateFrom, dateFrom) ||
|
||||
other.dateFrom == dateFrom) &&
|
||||
(identical(other.dateTo, dateTo) || other.dateTo == dateTo));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, dateFrom, dateTo);
|
||||
|
||||
/// Create a copy of InventoryAnalyticLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$RangeDateChangedImplCopyWith<_$RangeDateChangedImpl> get copyWith =>
|
||||
__$$RangeDateChangedImplCopyWithImpl<_$RangeDateChangedImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||
rangeDateChanged,
|
||||
required TResult Function() fetched,
|
||||
}) {
|
||||
return rangeDateChanged(dateFrom, dateTo);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult? Function()? fetched,
|
||||
}) {
|
||||
return rangeDateChanged?.call(dateFrom, dateTo);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult Function()? fetched,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (rangeDateChanged != null) {
|
||||
return rangeDateChanged(dateFrom, dateTo);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||
required TResult Function(_Fetched value) fetched,
|
||||
}) {
|
||||
return rangeDateChanged(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult? Function(_Fetched value)? fetched,
|
||||
}) {
|
||||
return rangeDateChanged?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult Function(_Fetched value)? fetched,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (rangeDateChanged != null) {
|
||||
return rangeDateChanged(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _RangeDateChanged implements InventoryAnalyticLoaderEvent {
|
||||
const factory _RangeDateChanged(
|
||||
final DateTime dateFrom,
|
||||
final DateTime dateTo,
|
||||
) = _$RangeDateChangedImpl;
|
||||
|
||||
DateTime get dateFrom;
|
||||
DateTime get dateTo;
|
||||
|
||||
/// Create a copy of InventoryAnalyticLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$RangeDateChangedImplCopyWith<_$RangeDateChangedImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$FetchedImplCopyWith<$Res> {
|
||||
factory _$$FetchedImplCopyWith(
|
||||
_$FetchedImpl value,
|
||||
$Res Function(_$FetchedImpl) then,
|
||||
) = __$$FetchedImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$FetchedImplCopyWithImpl<$Res>
|
||||
extends _$InventoryAnalyticLoaderEventCopyWithImpl<$Res, _$FetchedImpl>
|
||||
implements _$$FetchedImplCopyWith<$Res> {
|
||||
__$$FetchedImplCopyWithImpl(
|
||||
_$FetchedImpl _value,
|
||||
$Res Function(_$FetchedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of InventoryAnalyticLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$FetchedImpl implements _Fetched {
|
||||
const _$FetchedImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'InventoryAnalyticLoaderEvent.fetched()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$FetchedImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||
rangeDateChanged,
|
||||
required TResult Function() fetched,
|
||||
}) {
|
||||
return fetched();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult? Function()? fetched,
|
||||
}) {
|
||||
return fetched?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult Function()? fetched,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (fetched != null) {
|
||||
return fetched();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||
required TResult Function(_Fetched value) fetched,
|
||||
}) {
|
||||
return fetched(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult? Function(_Fetched value)? fetched,
|
||||
}) {
|
||||
return fetched?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult Function(_Fetched value)? fetched,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (fetched != null) {
|
||||
return fetched(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Fetched implements InventoryAnalyticLoaderEvent {
|
||||
const factory _Fetched() = _$FetchedImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$InventoryAnalyticLoaderState {
|
||||
InventoryAnalytic get inventoryAnalytic => throw _privateConstructorUsedError;
|
||||
Option<AnalyticFailure> get failureOptionInventoryAnalytic =>
|
||||
throw _privateConstructorUsedError;
|
||||
bool get isFetching => throw _privateConstructorUsedError;
|
||||
DateTime get dateFrom => throw _privateConstructorUsedError;
|
||||
DateTime get dateTo => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of InventoryAnalyticLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$InventoryAnalyticLoaderStateCopyWith<InventoryAnalyticLoaderState>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $InventoryAnalyticLoaderStateCopyWith<$Res> {
|
||||
factory $InventoryAnalyticLoaderStateCopyWith(
|
||||
InventoryAnalyticLoaderState value,
|
||||
$Res Function(InventoryAnalyticLoaderState) then,
|
||||
) =
|
||||
_$InventoryAnalyticLoaderStateCopyWithImpl<
|
||||
$Res,
|
||||
InventoryAnalyticLoaderState
|
||||
>;
|
||||
@useResult
|
||||
$Res call({
|
||||
InventoryAnalytic inventoryAnalytic,
|
||||
Option<AnalyticFailure> failureOptionInventoryAnalytic,
|
||||
bool isFetching,
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
});
|
||||
|
||||
$InventoryAnalyticCopyWith<$Res> get inventoryAnalytic;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$InventoryAnalyticLoaderStateCopyWithImpl<
|
||||
$Res,
|
||||
$Val extends InventoryAnalyticLoaderState
|
||||
>
|
||||
implements $InventoryAnalyticLoaderStateCopyWith<$Res> {
|
||||
_$InventoryAnalyticLoaderStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of InventoryAnalyticLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? inventoryAnalytic = null,
|
||||
Object? failureOptionInventoryAnalytic = null,
|
||||
Object? isFetching = null,
|
||||
Object? dateFrom = null,
|
||||
Object? dateTo = null,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
inventoryAnalytic: null == inventoryAnalytic
|
||||
? _value.inventoryAnalytic
|
||||
: inventoryAnalytic // ignore: cast_nullable_to_non_nullable
|
||||
as InventoryAnalytic,
|
||||
failureOptionInventoryAnalytic:
|
||||
null == failureOptionInventoryAnalytic
|
||||
? _value.failureOptionInventoryAnalytic
|
||||
: failureOptionInventoryAnalytic // ignore: cast_nullable_to_non_nullable
|
||||
as Option<AnalyticFailure>,
|
||||
isFetching: null == isFetching
|
||||
? _value.isFetching
|
||||
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
dateFrom: null == dateFrom
|
||||
? _value.dateFrom
|
||||
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
dateTo: null == dateTo
|
||||
? _value.dateTo
|
||||
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
|
||||
/// Create a copy of InventoryAnalyticLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$InventoryAnalyticCopyWith<$Res> get inventoryAnalytic {
|
||||
return $InventoryAnalyticCopyWith<$Res>(_value.inventoryAnalytic, (value) {
|
||||
return _then(_value.copyWith(inventoryAnalytic: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$InventoryAnalyticLoaderStateImplCopyWith<$Res>
|
||||
implements $InventoryAnalyticLoaderStateCopyWith<$Res> {
|
||||
factory _$$InventoryAnalyticLoaderStateImplCopyWith(
|
||||
_$InventoryAnalyticLoaderStateImpl value,
|
||||
$Res Function(_$InventoryAnalyticLoaderStateImpl) then,
|
||||
) = __$$InventoryAnalyticLoaderStateImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
InventoryAnalytic inventoryAnalytic,
|
||||
Option<AnalyticFailure> failureOptionInventoryAnalytic,
|
||||
bool isFetching,
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
});
|
||||
|
||||
@override
|
||||
$InventoryAnalyticCopyWith<$Res> get inventoryAnalytic;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$InventoryAnalyticLoaderStateImplCopyWithImpl<$Res>
|
||||
extends
|
||||
_$InventoryAnalyticLoaderStateCopyWithImpl<
|
||||
$Res,
|
||||
_$InventoryAnalyticLoaderStateImpl
|
||||
>
|
||||
implements _$$InventoryAnalyticLoaderStateImplCopyWith<$Res> {
|
||||
__$$InventoryAnalyticLoaderStateImplCopyWithImpl(
|
||||
_$InventoryAnalyticLoaderStateImpl _value,
|
||||
$Res Function(_$InventoryAnalyticLoaderStateImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of InventoryAnalyticLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? inventoryAnalytic = null,
|
||||
Object? failureOptionInventoryAnalytic = null,
|
||||
Object? isFetching = null,
|
||||
Object? dateFrom = null,
|
||||
Object? dateTo = null,
|
||||
}) {
|
||||
return _then(
|
||||
_$InventoryAnalyticLoaderStateImpl(
|
||||
inventoryAnalytic: null == inventoryAnalytic
|
||||
? _value.inventoryAnalytic
|
||||
: inventoryAnalytic // ignore: cast_nullable_to_non_nullable
|
||||
as InventoryAnalytic,
|
||||
failureOptionInventoryAnalytic: null == failureOptionInventoryAnalytic
|
||||
? _value.failureOptionInventoryAnalytic
|
||||
: failureOptionInventoryAnalytic // ignore: cast_nullable_to_non_nullable
|
||||
as Option<AnalyticFailure>,
|
||||
isFetching: null == isFetching
|
||||
? _value.isFetching
|
||||
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
dateFrom: null == dateFrom
|
||||
? _value.dateFrom
|
||||
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
dateTo: null == dateTo
|
||||
? _value.dateTo
|
||||
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$InventoryAnalyticLoaderStateImpl
|
||||
implements _InventoryAnalyticLoaderState {
|
||||
const _$InventoryAnalyticLoaderStateImpl({
|
||||
required this.inventoryAnalytic,
|
||||
required this.failureOptionInventoryAnalytic,
|
||||
this.isFetching = false,
|
||||
required this.dateFrom,
|
||||
required this.dateTo,
|
||||
});
|
||||
|
||||
@override
|
||||
final InventoryAnalytic inventoryAnalytic;
|
||||
@override
|
||||
final Option<AnalyticFailure> failureOptionInventoryAnalytic;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool isFetching;
|
||||
@override
|
||||
final DateTime dateFrom;
|
||||
@override
|
||||
final DateTime dateTo;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'InventoryAnalyticLoaderState(inventoryAnalytic: $inventoryAnalytic, failureOptionInventoryAnalytic: $failureOptionInventoryAnalytic, isFetching: $isFetching, dateFrom: $dateFrom, dateTo: $dateTo)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$InventoryAnalyticLoaderStateImpl &&
|
||||
(identical(other.inventoryAnalytic, inventoryAnalytic) ||
|
||||
other.inventoryAnalytic == inventoryAnalytic) &&
|
||||
(identical(
|
||||
other.failureOptionInventoryAnalytic,
|
||||
failureOptionInventoryAnalytic,
|
||||
) ||
|
||||
other.failureOptionInventoryAnalytic ==
|
||||
failureOptionInventoryAnalytic) &&
|
||||
(identical(other.isFetching, isFetching) ||
|
||||
other.isFetching == isFetching) &&
|
||||
(identical(other.dateFrom, dateFrom) ||
|
||||
other.dateFrom == dateFrom) &&
|
||||
(identical(other.dateTo, dateTo) || other.dateTo == dateTo));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
inventoryAnalytic,
|
||||
failureOptionInventoryAnalytic,
|
||||
isFetching,
|
||||
dateFrom,
|
||||
dateTo,
|
||||
);
|
||||
|
||||
/// Create a copy of InventoryAnalyticLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$InventoryAnalyticLoaderStateImplCopyWith<
|
||||
_$InventoryAnalyticLoaderStateImpl
|
||||
>
|
||||
get copyWith =>
|
||||
__$$InventoryAnalyticLoaderStateImplCopyWithImpl<
|
||||
_$InventoryAnalyticLoaderStateImpl
|
||||
>(this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _InventoryAnalyticLoaderState
|
||||
implements InventoryAnalyticLoaderState {
|
||||
const factory _InventoryAnalyticLoaderState({
|
||||
required final InventoryAnalytic inventoryAnalytic,
|
||||
required final Option<AnalyticFailure> failureOptionInventoryAnalytic,
|
||||
final bool isFetching,
|
||||
required final DateTime dateFrom,
|
||||
required final DateTime dateTo,
|
||||
}) = _$InventoryAnalyticLoaderStateImpl;
|
||||
|
||||
@override
|
||||
InventoryAnalytic get inventoryAnalytic;
|
||||
@override
|
||||
Option<AnalyticFailure> get failureOptionInventoryAnalytic;
|
||||
@override
|
||||
bool get isFetching;
|
||||
@override
|
||||
DateTime get dateFrom;
|
||||
@override
|
||||
DateTime get dateTo;
|
||||
|
||||
/// Create a copy of InventoryAnalyticLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$InventoryAnalyticLoaderStateImplCopyWith<
|
||||
_$InventoryAnalyticLoaderStateImpl
|
||||
>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
part of 'inventory_analytic_loader_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class InventoryAnalyticLoaderEvent with _$InventoryAnalyticLoaderEvent {
|
||||
const factory InventoryAnalyticLoaderEvent.rangeDateChanged(
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
) = _RangeDateChanged;
|
||||
const factory InventoryAnalyticLoaderEvent.fetched() = _Fetched;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
part of 'inventory_analytic_loader_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class InventoryAnalyticLoaderState with _$InventoryAnalyticLoaderState {
|
||||
const factory InventoryAnalyticLoaderState({
|
||||
required InventoryAnalytic inventoryAnalytic,
|
||||
required Option<AnalyticFailure> failureOptionInventoryAnalytic,
|
||||
@Default(false) bool isFetching,
|
||||
required DateTime dateFrom,
|
||||
required DateTime dateTo,
|
||||
}) = _InventoryAnalyticLoaderState;
|
||||
|
||||
factory InventoryAnalyticLoaderState.initial() =>
|
||||
InventoryAnalyticLoaderState(
|
||||
inventoryAnalytic: InventoryAnalytic.empty(),
|
||||
failureOptionInventoryAnalytic: none(),
|
||||
dateFrom: DateTime.now().subtract(const Duration(days: 30)),
|
||||
dateTo: DateTime.now(),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
|
||||
import '../../../domain/analytic/analytic.dart';
|
||||
import '../../../domain/analytic/repositories/i_analytic_repository.dart';
|
||||
|
||||
part 'payment_method_analytic_loader_event.dart';
|
||||
part 'payment_method_analytic_loader_state.dart';
|
||||
part 'payment_method_analytic_loader_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class PaymentMethodAnalyticLoaderBloc
|
||||
extends
|
||||
Bloc<
|
||||
PaymentMethodAnalyticLoaderEvent,
|
||||
PaymentMethodAnalyticLoaderState
|
||||
> {
|
||||
final IAnalyticRepository _repository;
|
||||
PaymentMethodAnalyticLoaderBloc(this._repository)
|
||||
: super(PaymentMethodAnalyticLoaderState.initial()) {
|
||||
on<PaymentMethodAnalyticLoaderEvent>(_onPaymentMethodAnalyticLoaderEvent);
|
||||
}
|
||||
|
||||
Future<void> _onPaymentMethodAnalyticLoaderEvent(
|
||||
PaymentMethodAnalyticLoaderEvent event,
|
||||
Emitter<PaymentMethodAnalyticLoaderState> emit,
|
||||
) {
|
||||
return event.map(
|
||||
rangeDateChanged: (e) async {
|
||||
emit(state.copyWith(dateFrom: e.dateFrom, dateTo: e.dateTo));
|
||||
},
|
||||
fetched: (e) async {
|
||||
emit(
|
||||
state.copyWith(
|
||||
isFetching: true,
|
||||
failureOptionPaymentMethodAnalytic: none(),
|
||||
),
|
||||
);
|
||||
|
||||
final result = await _repository.getPaymentMethod(
|
||||
dateFrom: state.dateFrom,
|
||||
dateTo: state.dateTo,
|
||||
);
|
||||
|
||||
var data = result.fold(
|
||||
(f) =>
|
||||
state.copyWith(failureOptionPaymentMethodAnalytic: optionOf(f)),
|
||||
(paymentMethodAnalytic) =>
|
||||
state.copyWith(paymentMethodAnalytic: paymentMethodAnalytic),
|
||||
);
|
||||
|
||||
emit(data.copyWith(isFetching: false));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,633 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'payment_method_analytic_loader_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
|
||||
/// @nodoc
|
||||
mixin _$PaymentMethodAnalyticLoaderEvent {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||
rangeDateChanged,
|
||||
required TResult Function() fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult? Function()? fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult Function()? fetched,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||
required TResult Function(_Fetched value) fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult? Function(_Fetched value)? fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult Function(_Fetched value)? fetched,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $PaymentMethodAnalyticLoaderEventCopyWith<$Res> {
|
||||
factory $PaymentMethodAnalyticLoaderEventCopyWith(
|
||||
PaymentMethodAnalyticLoaderEvent value,
|
||||
$Res Function(PaymentMethodAnalyticLoaderEvent) then,
|
||||
) =
|
||||
_$PaymentMethodAnalyticLoaderEventCopyWithImpl<
|
||||
$Res,
|
||||
PaymentMethodAnalyticLoaderEvent
|
||||
>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$PaymentMethodAnalyticLoaderEventCopyWithImpl<
|
||||
$Res,
|
||||
$Val extends PaymentMethodAnalyticLoaderEvent
|
||||
>
|
||||
implements $PaymentMethodAnalyticLoaderEventCopyWith<$Res> {
|
||||
_$PaymentMethodAnalyticLoaderEventCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of PaymentMethodAnalyticLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$RangeDateChangedImplCopyWith<$Res> {
|
||||
factory _$$RangeDateChangedImplCopyWith(
|
||||
_$RangeDateChangedImpl value,
|
||||
$Res Function(_$RangeDateChangedImpl) then,
|
||||
) = __$$RangeDateChangedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({DateTime dateFrom, DateTime dateTo});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$RangeDateChangedImplCopyWithImpl<$Res>
|
||||
extends
|
||||
_$PaymentMethodAnalyticLoaderEventCopyWithImpl<
|
||||
$Res,
|
||||
_$RangeDateChangedImpl
|
||||
>
|
||||
implements _$$RangeDateChangedImplCopyWith<$Res> {
|
||||
__$$RangeDateChangedImplCopyWithImpl(
|
||||
_$RangeDateChangedImpl _value,
|
||||
$Res Function(_$RangeDateChangedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of PaymentMethodAnalyticLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? dateFrom = null, Object? dateTo = null}) {
|
||||
return _then(
|
||||
_$RangeDateChangedImpl(
|
||||
null == dateFrom
|
||||
? _value.dateFrom
|
||||
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
null == dateTo
|
||||
? _value.dateTo
|
||||
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$RangeDateChangedImpl implements _RangeDateChanged {
|
||||
const _$RangeDateChangedImpl(this.dateFrom, this.dateTo);
|
||||
|
||||
@override
|
||||
final DateTime dateFrom;
|
||||
@override
|
||||
final DateTime dateTo;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PaymentMethodAnalyticLoaderEvent.rangeDateChanged(dateFrom: $dateFrom, dateTo: $dateTo)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$RangeDateChangedImpl &&
|
||||
(identical(other.dateFrom, dateFrom) ||
|
||||
other.dateFrom == dateFrom) &&
|
||||
(identical(other.dateTo, dateTo) || other.dateTo == dateTo));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, dateFrom, dateTo);
|
||||
|
||||
/// Create a copy of PaymentMethodAnalyticLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$RangeDateChangedImplCopyWith<_$RangeDateChangedImpl> get copyWith =>
|
||||
__$$RangeDateChangedImplCopyWithImpl<_$RangeDateChangedImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||
rangeDateChanged,
|
||||
required TResult Function() fetched,
|
||||
}) {
|
||||
return rangeDateChanged(dateFrom, dateTo);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult? Function()? fetched,
|
||||
}) {
|
||||
return rangeDateChanged?.call(dateFrom, dateTo);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult Function()? fetched,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (rangeDateChanged != null) {
|
||||
return rangeDateChanged(dateFrom, dateTo);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||
required TResult Function(_Fetched value) fetched,
|
||||
}) {
|
||||
return rangeDateChanged(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult? Function(_Fetched value)? fetched,
|
||||
}) {
|
||||
return rangeDateChanged?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult Function(_Fetched value)? fetched,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (rangeDateChanged != null) {
|
||||
return rangeDateChanged(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _RangeDateChanged implements PaymentMethodAnalyticLoaderEvent {
|
||||
const factory _RangeDateChanged(
|
||||
final DateTime dateFrom,
|
||||
final DateTime dateTo,
|
||||
) = _$RangeDateChangedImpl;
|
||||
|
||||
DateTime get dateFrom;
|
||||
DateTime get dateTo;
|
||||
|
||||
/// Create a copy of PaymentMethodAnalyticLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$RangeDateChangedImplCopyWith<_$RangeDateChangedImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$FetchedImplCopyWith<$Res> {
|
||||
factory _$$FetchedImplCopyWith(
|
||||
_$FetchedImpl value,
|
||||
$Res Function(_$FetchedImpl) then,
|
||||
) = __$$FetchedImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$FetchedImplCopyWithImpl<$Res>
|
||||
extends _$PaymentMethodAnalyticLoaderEventCopyWithImpl<$Res, _$FetchedImpl>
|
||||
implements _$$FetchedImplCopyWith<$Res> {
|
||||
__$$FetchedImplCopyWithImpl(
|
||||
_$FetchedImpl _value,
|
||||
$Res Function(_$FetchedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of PaymentMethodAnalyticLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$FetchedImpl implements _Fetched {
|
||||
const _$FetchedImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PaymentMethodAnalyticLoaderEvent.fetched()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$FetchedImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||
rangeDateChanged,
|
||||
required TResult Function() fetched,
|
||||
}) {
|
||||
return fetched();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult? Function()? fetched,
|
||||
}) {
|
||||
return fetched?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult Function()? fetched,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (fetched != null) {
|
||||
return fetched();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||
required TResult Function(_Fetched value) fetched,
|
||||
}) {
|
||||
return fetched(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult? Function(_Fetched value)? fetched,
|
||||
}) {
|
||||
return fetched?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult Function(_Fetched value)? fetched,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (fetched != null) {
|
||||
return fetched(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Fetched implements PaymentMethodAnalyticLoaderEvent {
|
||||
const factory _Fetched() = _$FetchedImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$PaymentMethodAnalyticLoaderState {
|
||||
PaymentMethodAnalytic get paymentMethodAnalytic =>
|
||||
throw _privateConstructorUsedError;
|
||||
Option<AnalyticFailure> get failureOptionPaymentMethodAnalytic =>
|
||||
throw _privateConstructorUsedError;
|
||||
bool get isFetching => throw _privateConstructorUsedError;
|
||||
DateTime get dateFrom => throw _privateConstructorUsedError;
|
||||
DateTime get dateTo => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of PaymentMethodAnalyticLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$PaymentMethodAnalyticLoaderStateCopyWith<PaymentMethodAnalyticLoaderState>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $PaymentMethodAnalyticLoaderStateCopyWith<$Res> {
|
||||
factory $PaymentMethodAnalyticLoaderStateCopyWith(
|
||||
PaymentMethodAnalyticLoaderState value,
|
||||
$Res Function(PaymentMethodAnalyticLoaderState) then,
|
||||
) =
|
||||
_$PaymentMethodAnalyticLoaderStateCopyWithImpl<
|
||||
$Res,
|
||||
PaymentMethodAnalyticLoaderState
|
||||
>;
|
||||
@useResult
|
||||
$Res call({
|
||||
PaymentMethodAnalytic paymentMethodAnalytic,
|
||||
Option<AnalyticFailure> failureOptionPaymentMethodAnalytic,
|
||||
bool isFetching,
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
});
|
||||
|
||||
$PaymentMethodAnalyticCopyWith<$Res> get paymentMethodAnalytic;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$PaymentMethodAnalyticLoaderStateCopyWithImpl<
|
||||
$Res,
|
||||
$Val extends PaymentMethodAnalyticLoaderState
|
||||
>
|
||||
implements $PaymentMethodAnalyticLoaderStateCopyWith<$Res> {
|
||||
_$PaymentMethodAnalyticLoaderStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of PaymentMethodAnalyticLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? paymentMethodAnalytic = null,
|
||||
Object? failureOptionPaymentMethodAnalytic = null,
|
||||
Object? isFetching = null,
|
||||
Object? dateFrom = null,
|
||||
Object? dateTo = null,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
paymentMethodAnalytic: null == paymentMethodAnalytic
|
||||
? _value.paymentMethodAnalytic
|
||||
: paymentMethodAnalytic // ignore: cast_nullable_to_non_nullable
|
||||
as PaymentMethodAnalytic,
|
||||
failureOptionPaymentMethodAnalytic:
|
||||
null == failureOptionPaymentMethodAnalytic
|
||||
? _value.failureOptionPaymentMethodAnalytic
|
||||
: failureOptionPaymentMethodAnalytic // ignore: cast_nullable_to_non_nullable
|
||||
as Option<AnalyticFailure>,
|
||||
isFetching: null == isFetching
|
||||
? _value.isFetching
|
||||
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
dateFrom: null == dateFrom
|
||||
? _value.dateFrom
|
||||
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
dateTo: null == dateTo
|
||||
? _value.dateTo
|
||||
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
|
||||
/// Create a copy of PaymentMethodAnalyticLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$PaymentMethodAnalyticCopyWith<$Res> get paymentMethodAnalytic {
|
||||
return $PaymentMethodAnalyticCopyWith<$Res>(_value.paymentMethodAnalytic, (
|
||||
value,
|
||||
) {
|
||||
return _then(_value.copyWith(paymentMethodAnalytic: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$PaymentMethodAnalyticLoaderStateImplCopyWith<$Res>
|
||||
implements $PaymentMethodAnalyticLoaderStateCopyWith<$Res> {
|
||||
factory _$$PaymentMethodAnalyticLoaderStateImplCopyWith(
|
||||
_$PaymentMethodAnalyticLoaderStateImpl value,
|
||||
$Res Function(_$PaymentMethodAnalyticLoaderStateImpl) then,
|
||||
) = __$$PaymentMethodAnalyticLoaderStateImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
PaymentMethodAnalytic paymentMethodAnalytic,
|
||||
Option<AnalyticFailure> failureOptionPaymentMethodAnalytic,
|
||||
bool isFetching,
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
});
|
||||
|
||||
@override
|
||||
$PaymentMethodAnalyticCopyWith<$Res> get paymentMethodAnalytic;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$PaymentMethodAnalyticLoaderStateImplCopyWithImpl<$Res>
|
||||
extends
|
||||
_$PaymentMethodAnalyticLoaderStateCopyWithImpl<
|
||||
$Res,
|
||||
_$PaymentMethodAnalyticLoaderStateImpl
|
||||
>
|
||||
implements _$$PaymentMethodAnalyticLoaderStateImplCopyWith<$Res> {
|
||||
__$$PaymentMethodAnalyticLoaderStateImplCopyWithImpl(
|
||||
_$PaymentMethodAnalyticLoaderStateImpl _value,
|
||||
$Res Function(_$PaymentMethodAnalyticLoaderStateImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of PaymentMethodAnalyticLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? paymentMethodAnalytic = null,
|
||||
Object? failureOptionPaymentMethodAnalytic = null,
|
||||
Object? isFetching = null,
|
||||
Object? dateFrom = null,
|
||||
Object? dateTo = null,
|
||||
}) {
|
||||
return _then(
|
||||
_$PaymentMethodAnalyticLoaderStateImpl(
|
||||
paymentMethodAnalytic: null == paymentMethodAnalytic
|
||||
? _value.paymentMethodAnalytic
|
||||
: paymentMethodAnalytic // ignore: cast_nullable_to_non_nullable
|
||||
as PaymentMethodAnalytic,
|
||||
failureOptionPaymentMethodAnalytic:
|
||||
null == failureOptionPaymentMethodAnalytic
|
||||
? _value.failureOptionPaymentMethodAnalytic
|
||||
: failureOptionPaymentMethodAnalytic // ignore: cast_nullable_to_non_nullable
|
||||
as Option<AnalyticFailure>,
|
||||
isFetching: null == isFetching
|
||||
? _value.isFetching
|
||||
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
dateFrom: null == dateFrom
|
||||
? _value.dateFrom
|
||||
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
dateTo: null == dateTo
|
||||
? _value.dateTo
|
||||
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$PaymentMethodAnalyticLoaderStateImpl
|
||||
implements _PaymentMethodAnalyticLoaderState {
|
||||
const _$PaymentMethodAnalyticLoaderStateImpl({
|
||||
required this.paymentMethodAnalytic,
|
||||
required this.failureOptionPaymentMethodAnalytic,
|
||||
this.isFetching = false,
|
||||
required this.dateFrom,
|
||||
required this.dateTo,
|
||||
});
|
||||
|
||||
@override
|
||||
final PaymentMethodAnalytic paymentMethodAnalytic;
|
||||
@override
|
||||
final Option<AnalyticFailure> failureOptionPaymentMethodAnalytic;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool isFetching;
|
||||
@override
|
||||
final DateTime dateFrom;
|
||||
@override
|
||||
final DateTime dateTo;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PaymentMethodAnalyticLoaderState(paymentMethodAnalytic: $paymentMethodAnalytic, failureOptionPaymentMethodAnalytic: $failureOptionPaymentMethodAnalytic, isFetching: $isFetching, dateFrom: $dateFrom, dateTo: $dateTo)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$PaymentMethodAnalyticLoaderStateImpl &&
|
||||
(identical(other.paymentMethodAnalytic, paymentMethodAnalytic) ||
|
||||
other.paymentMethodAnalytic == paymentMethodAnalytic) &&
|
||||
(identical(
|
||||
other.failureOptionPaymentMethodAnalytic,
|
||||
failureOptionPaymentMethodAnalytic,
|
||||
) ||
|
||||
other.failureOptionPaymentMethodAnalytic ==
|
||||
failureOptionPaymentMethodAnalytic) &&
|
||||
(identical(other.isFetching, isFetching) ||
|
||||
other.isFetching == isFetching) &&
|
||||
(identical(other.dateFrom, dateFrom) ||
|
||||
other.dateFrom == dateFrom) &&
|
||||
(identical(other.dateTo, dateTo) || other.dateTo == dateTo));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
paymentMethodAnalytic,
|
||||
failureOptionPaymentMethodAnalytic,
|
||||
isFetching,
|
||||
dateFrom,
|
||||
dateTo,
|
||||
);
|
||||
|
||||
/// Create a copy of PaymentMethodAnalyticLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$PaymentMethodAnalyticLoaderStateImplCopyWith<
|
||||
_$PaymentMethodAnalyticLoaderStateImpl
|
||||
>
|
||||
get copyWith =>
|
||||
__$$PaymentMethodAnalyticLoaderStateImplCopyWithImpl<
|
||||
_$PaymentMethodAnalyticLoaderStateImpl
|
||||
>(this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _PaymentMethodAnalyticLoaderState
|
||||
implements PaymentMethodAnalyticLoaderState {
|
||||
const factory _PaymentMethodAnalyticLoaderState({
|
||||
required final PaymentMethodAnalytic paymentMethodAnalytic,
|
||||
required final Option<AnalyticFailure> failureOptionPaymentMethodAnalytic,
|
||||
final bool isFetching,
|
||||
required final DateTime dateFrom,
|
||||
required final DateTime dateTo,
|
||||
}) = _$PaymentMethodAnalyticLoaderStateImpl;
|
||||
|
||||
@override
|
||||
PaymentMethodAnalytic get paymentMethodAnalytic;
|
||||
@override
|
||||
Option<AnalyticFailure> get failureOptionPaymentMethodAnalytic;
|
||||
@override
|
||||
bool get isFetching;
|
||||
@override
|
||||
DateTime get dateFrom;
|
||||
@override
|
||||
DateTime get dateTo;
|
||||
|
||||
/// Create a copy of PaymentMethodAnalyticLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$PaymentMethodAnalyticLoaderStateImplCopyWith<
|
||||
_$PaymentMethodAnalyticLoaderStateImpl
|
||||
>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
part of 'payment_method_analytic_loader_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class PaymentMethodAnalyticLoaderEvent with _$PaymentMethodAnalyticLoaderEvent {
|
||||
const factory PaymentMethodAnalyticLoaderEvent.rangeDateChanged(
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
) = _RangeDateChanged;
|
||||
const factory PaymentMethodAnalyticLoaderEvent.fetched() = _Fetched;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
part of 'payment_method_analytic_loader_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class PaymentMethodAnalyticLoaderState with _$PaymentMethodAnalyticLoaderState {
|
||||
const factory PaymentMethodAnalyticLoaderState({
|
||||
required PaymentMethodAnalytic paymentMethodAnalytic,
|
||||
required Option<AnalyticFailure> failureOptionPaymentMethodAnalytic,
|
||||
@Default(false) bool isFetching,
|
||||
required DateTime dateFrom,
|
||||
required DateTime dateTo,
|
||||
}) = _PaymentMethodAnalyticLoaderState;
|
||||
|
||||
factory PaymentMethodAnalyticLoaderState.initial() =>
|
||||
PaymentMethodAnalyticLoaderState(
|
||||
paymentMethodAnalytic: PaymentMethodAnalytic.empty(),
|
||||
failureOptionPaymentMethodAnalytic: none(),
|
||||
dateFrom: DateTime.now(),
|
||||
dateTo: DateTime.now(),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
|
||||
import '../../../domain/analytic/analytic.dart';
|
||||
import '../../../domain/analytic/repositories/i_analytic_repository.dart';
|
||||
|
||||
part 'product_analytic_loader_event.dart';
|
||||
part 'product_analytic_loader_state.dart';
|
||||
part 'product_analytic_loader_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class ProductAnalyticLoaderBloc
|
||||
extends Bloc<ProductAnalyticLoaderEvent, ProductAnalyticLoaderState> {
|
||||
final IAnalyticRepository _repository;
|
||||
ProductAnalyticLoaderBloc(this._repository)
|
||||
: super(ProductAnalyticLoaderState.initial()) {
|
||||
on<ProductAnalyticLoaderEvent>(_onProductAnalyticLoaderEvent);
|
||||
}
|
||||
|
||||
Future<void> _onProductAnalyticLoaderEvent(
|
||||
ProductAnalyticLoaderEvent event,
|
||||
Emitter<ProductAnalyticLoaderState> emit,
|
||||
) {
|
||||
return event.map(
|
||||
rangeDateChanged: (e) async {
|
||||
emit(state.copyWith(dateFrom: e.dateFrom, dateTo: e.dateTo));
|
||||
},
|
||||
fetched: (e) async {
|
||||
emit(
|
||||
state.copyWith(
|
||||
isFetching: true,
|
||||
failureOptionProductAnalytic: none(),
|
||||
),
|
||||
);
|
||||
|
||||
final result = await _repository.getProduct(
|
||||
dateFrom: state.dateFrom,
|
||||
dateTo: state.dateTo,
|
||||
);
|
||||
|
||||
var data = result.fold(
|
||||
(f) => state.copyWith(failureOptionProductAnalytic: optionOf(f)),
|
||||
(productAnalytic) => state.copyWith(productAnalytic: productAnalytic),
|
||||
);
|
||||
|
||||
emit(data.copyWith(isFetching: false));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,620 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'product_analytic_loader_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ProductAnalyticLoaderEvent {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||
rangeDateChanged,
|
||||
required TResult Function() fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult? Function()? fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult Function()? fetched,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||
required TResult Function(_Fetched value) fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult? Function(_Fetched value)? fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult Function(_Fetched value)? fetched,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $ProductAnalyticLoaderEventCopyWith<$Res> {
|
||||
factory $ProductAnalyticLoaderEventCopyWith(
|
||||
ProductAnalyticLoaderEvent value,
|
||||
$Res Function(ProductAnalyticLoaderEvent) then,
|
||||
) =
|
||||
_$ProductAnalyticLoaderEventCopyWithImpl<
|
||||
$Res,
|
||||
ProductAnalyticLoaderEvent
|
||||
>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$ProductAnalyticLoaderEventCopyWithImpl<
|
||||
$Res,
|
||||
$Val extends ProductAnalyticLoaderEvent
|
||||
>
|
||||
implements $ProductAnalyticLoaderEventCopyWith<$Res> {
|
||||
_$ProductAnalyticLoaderEventCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of ProductAnalyticLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$RangeDateChangedImplCopyWith<$Res> {
|
||||
factory _$$RangeDateChangedImplCopyWith(
|
||||
_$RangeDateChangedImpl value,
|
||||
$Res Function(_$RangeDateChangedImpl) then,
|
||||
) = __$$RangeDateChangedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({DateTime dateFrom, DateTime dateTo});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$RangeDateChangedImplCopyWithImpl<$Res>
|
||||
extends
|
||||
_$ProductAnalyticLoaderEventCopyWithImpl<$Res, _$RangeDateChangedImpl>
|
||||
implements _$$RangeDateChangedImplCopyWith<$Res> {
|
||||
__$$RangeDateChangedImplCopyWithImpl(
|
||||
_$RangeDateChangedImpl _value,
|
||||
$Res Function(_$RangeDateChangedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of ProductAnalyticLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? dateFrom = null, Object? dateTo = null}) {
|
||||
return _then(
|
||||
_$RangeDateChangedImpl(
|
||||
null == dateFrom
|
||||
? _value.dateFrom
|
||||
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
null == dateTo
|
||||
? _value.dateTo
|
||||
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$RangeDateChangedImpl implements _RangeDateChanged {
|
||||
const _$RangeDateChangedImpl(this.dateFrom, this.dateTo);
|
||||
|
||||
@override
|
||||
final DateTime dateFrom;
|
||||
@override
|
||||
final DateTime dateTo;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ProductAnalyticLoaderEvent.rangeDateChanged(dateFrom: $dateFrom, dateTo: $dateTo)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$RangeDateChangedImpl &&
|
||||
(identical(other.dateFrom, dateFrom) ||
|
||||
other.dateFrom == dateFrom) &&
|
||||
(identical(other.dateTo, dateTo) || other.dateTo == dateTo));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, dateFrom, dateTo);
|
||||
|
||||
/// Create a copy of ProductAnalyticLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$RangeDateChangedImplCopyWith<_$RangeDateChangedImpl> get copyWith =>
|
||||
__$$RangeDateChangedImplCopyWithImpl<_$RangeDateChangedImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||
rangeDateChanged,
|
||||
required TResult Function() fetched,
|
||||
}) {
|
||||
return rangeDateChanged(dateFrom, dateTo);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult? Function()? fetched,
|
||||
}) {
|
||||
return rangeDateChanged?.call(dateFrom, dateTo);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult Function()? fetched,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (rangeDateChanged != null) {
|
||||
return rangeDateChanged(dateFrom, dateTo);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||
required TResult Function(_Fetched value) fetched,
|
||||
}) {
|
||||
return rangeDateChanged(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult? Function(_Fetched value)? fetched,
|
||||
}) {
|
||||
return rangeDateChanged?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult Function(_Fetched value)? fetched,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (rangeDateChanged != null) {
|
||||
return rangeDateChanged(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _RangeDateChanged implements ProductAnalyticLoaderEvent {
|
||||
const factory _RangeDateChanged(
|
||||
final DateTime dateFrom,
|
||||
final DateTime dateTo,
|
||||
) = _$RangeDateChangedImpl;
|
||||
|
||||
DateTime get dateFrom;
|
||||
DateTime get dateTo;
|
||||
|
||||
/// Create a copy of ProductAnalyticLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$RangeDateChangedImplCopyWith<_$RangeDateChangedImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$FetchedImplCopyWith<$Res> {
|
||||
factory _$$FetchedImplCopyWith(
|
||||
_$FetchedImpl value,
|
||||
$Res Function(_$FetchedImpl) then,
|
||||
) = __$$FetchedImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$FetchedImplCopyWithImpl<$Res>
|
||||
extends _$ProductAnalyticLoaderEventCopyWithImpl<$Res, _$FetchedImpl>
|
||||
implements _$$FetchedImplCopyWith<$Res> {
|
||||
__$$FetchedImplCopyWithImpl(
|
||||
_$FetchedImpl _value,
|
||||
$Res Function(_$FetchedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of ProductAnalyticLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$FetchedImpl implements _Fetched {
|
||||
const _$FetchedImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ProductAnalyticLoaderEvent.fetched()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$FetchedImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||
rangeDateChanged,
|
||||
required TResult Function() fetched,
|
||||
}) {
|
||||
return fetched();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult? Function()? fetched,
|
||||
}) {
|
||||
return fetched?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult Function()? fetched,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (fetched != null) {
|
||||
return fetched();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||
required TResult Function(_Fetched value) fetched,
|
||||
}) {
|
||||
return fetched(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult? Function(_Fetched value)? fetched,
|
||||
}) {
|
||||
return fetched?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult Function(_Fetched value)? fetched,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (fetched != null) {
|
||||
return fetched(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Fetched implements ProductAnalyticLoaderEvent {
|
||||
const factory _Fetched() = _$FetchedImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ProductAnalyticLoaderState {
|
||||
ProductAnalytic get productAnalytic => throw _privateConstructorUsedError;
|
||||
Option<AnalyticFailure> get failureOptionProductAnalytic =>
|
||||
throw _privateConstructorUsedError;
|
||||
bool get isFetching => throw _privateConstructorUsedError;
|
||||
DateTime get dateFrom => throw _privateConstructorUsedError;
|
||||
DateTime get dateTo => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of ProductAnalyticLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$ProductAnalyticLoaderStateCopyWith<ProductAnalyticLoaderState>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $ProductAnalyticLoaderStateCopyWith<$Res> {
|
||||
factory $ProductAnalyticLoaderStateCopyWith(
|
||||
ProductAnalyticLoaderState value,
|
||||
$Res Function(ProductAnalyticLoaderState) then,
|
||||
) =
|
||||
_$ProductAnalyticLoaderStateCopyWithImpl<
|
||||
$Res,
|
||||
ProductAnalyticLoaderState
|
||||
>;
|
||||
@useResult
|
||||
$Res call({
|
||||
ProductAnalytic productAnalytic,
|
||||
Option<AnalyticFailure> failureOptionProductAnalytic,
|
||||
bool isFetching,
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
});
|
||||
|
||||
$ProductAnalyticCopyWith<$Res> get productAnalytic;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$ProductAnalyticLoaderStateCopyWithImpl<
|
||||
$Res,
|
||||
$Val extends ProductAnalyticLoaderState
|
||||
>
|
||||
implements $ProductAnalyticLoaderStateCopyWith<$Res> {
|
||||
_$ProductAnalyticLoaderStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of ProductAnalyticLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? productAnalytic = null,
|
||||
Object? failureOptionProductAnalytic = null,
|
||||
Object? isFetching = null,
|
||||
Object? dateFrom = null,
|
||||
Object? dateTo = null,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
productAnalytic: null == productAnalytic
|
||||
? _value.productAnalytic
|
||||
: productAnalytic // ignore: cast_nullable_to_non_nullable
|
||||
as ProductAnalytic,
|
||||
failureOptionProductAnalytic: null == failureOptionProductAnalytic
|
||||
? _value.failureOptionProductAnalytic
|
||||
: failureOptionProductAnalytic // ignore: cast_nullable_to_non_nullable
|
||||
as Option<AnalyticFailure>,
|
||||
isFetching: null == isFetching
|
||||
? _value.isFetching
|
||||
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
dateFrom: null == dateFrom
|
||||
? _value.dateFrom
|
||||
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
dateTo: null == dateTo
|
||||
? _value.dateTo
|
||||
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
|
||||
/// Create a copy of ProductAnalyticLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$ProductAnalyticCopyWith<$Res> get productAnalytic {
|
||||
return $ProductAnalyticCopyWith<$Res>(_value.productAnalytic, (value) {
|
||||
return _then(_value.copyWith(productAnalytic: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ProductAnalyticLoaderStateImplCopyWith<$Res>
|
||||
implements $ProductAnalyticLoaderStateCopyWith<$Res> {
|
||||
factory _$$ProductAnalyticLoaderStateImplCopyWith(
|
||||
_$ProductAnalyticLoaderStateImpl value,
|
||||
$Res Function(_$ProductAnalyticLoaderStateImpl) then,
|
||||
) = __$$ProductAnalyticLoaderStateImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
ProductAnalytic productAnalytic,
|
||||
Option<AnalyticFailure> failureOptionProductAnalytic,
|
||||
bool isFetching,
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
});
|
||||
|
||||
@override
|
||||
$ProductAnalyticCopyWith<$Res> get productAnalytic;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ProductAnalyticLoaderStateImplCopyWithImpl<$Res>
|
||||
extends
|
||||
_$ProductAnalyticLoaderStateCopyWithImpl<
|
||||
$Res,
|
||||
_$ProductAnalyticLoaderStateImpl
|
||||
>
|
||||
implements _$$ProductAnalyticLoaderStateImplCopyWith<$Res> {
|
||||
__$$ProductAnalyticLoaderStateImplCopyWithImpl(
|
||||
_$ProductAnalyticLoaderStateImpl _value,
|
||||
$Res Function(_$ProductAnalyticLoaderStateImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of ProductAnalyticLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? productAnalytic = null,
|
||||
Object? failureOptionProductAnalytic = null,
|
||||
Object? isFetching = null,
|
||||
Object? dateFrom = null,
|
||||
Object? dateTo = null,
|
||||
}) {
|
||||
return _then(
|
||||
_$ProductAnalyticLoaderStateImpl(
|
||||
productAnalytic: null == productAnalytic
|
||||
? _value.productAnalytic
|
||||
: productAnalytic // ignore: cast_nullable_to_non_nullable
|
||||
as ProductAnalytic,
|
||||
failureOptionProductAnalytic: null == failureOptionProductAnalytic
|
||||
? _value.failureOptionProductAnalytic
|
||||
: failureOptionProductAnalytic // ignore: cast_nullable_to_non_nullable
|
||||
as Option<AnalyticFailure>,
|
||||
isFetching: null == isFetching
|
||||
? _value.isFetching
|
||||
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
dateFrom: null == dateFrom
|
||||
? _value.dateFrom
|
||||
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
dateTo: null == dateTo
|
||||
? _value.dateTo
|
||||
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$ProductAnalyticLoaderStateImpl implements _ProductAnalyticLoaderState {
|
||||
const _$ProductAnalyticLoaderStateImpl({
|
||||
required this.productAnalytic,
|
||||
required this.failureOptionProductAnalytic,
|
||||
this.isFetching = false,
|
||||
required this.dateFrom,
|
||||
required this.dateTo,
|
||||
});
|
||||
|
||||
@override
|
||||
final ProductAnalytic productAnalytic;
|
||||
@override
|
||||
final Option<AnalyticFailure> failureOptionProductAnalytic;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool isFetching;
|
||||
@override
|
||||
final DateTime dateFrom;
|
||||
@override
|
||||
final DateTime dateTo;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ProductAnalyticLoaderState(productAnalytic: $productAnalytic, failureOptionProductAnalytic: $failureOptionProductAnalytic, isFetching: $isFetching, dateFrom: $dateFrom, dateTo: $dateTo)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ProductAnalyticLoaderStateImpl &&
|
||||
(identical(other.productAnalytic, productAnalytic) ||
|
||||
other.productAnalytic == productAnalytic) &&
|
||||
(identical(
|
||||
other.failureOptionProductAnalytic,
|
||||
failureOptionProductAnalytic,
|
||||
) ||
|
||||
other.failureOptionProductAnalytic ==
|
||||
failureOptionProductAnalytic) &&
|
||||
(identical(other.isFetching, isFetching) ||
|
||||
other.isFetching == isFetching) &&
|
||||
(identical(other.dateFrom, dateFrom) ||
|
||||
other.dateFrom == dateFrom) &&
|
||||
(identical(other.dateTo, dateTo) || other.dateTo == dateTo));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
productAnalytic,
|
||||
failureOptionProductAnalytic,
|
||||
isFetching,
|
||||
dateFrom,
|
||||
dateTo,
|
||||
);
|
||||
|
||||
/// Create a copy of ProductAnalyticLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$ProductAnalyticLoaderStateImplCopyWith<_$ProductAnalyticLoaderStateImpl>
|
||||
get copyWith =>
|
||||
__$$ProductAnalyticLoaderStateImplCopyWithImpl<
|
||||
_$ProductAnalyticLoaderStateImpl
|
||||
>(this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _ProductAnalyticLoaderState
|
||||
implements ProductAnalyticLoaderState {
|
||||
const factory _ProductAnalyticLoaderState({
|
||||
required final ProductAnalytic productAnalytic,
|
||||
required final Option<AnalyticFailure> failureOptionProductAnalytic,
|
||||
final bool isFetching,
|
||||
required final DateTime dateFrom,
|
||||
required final DateTime dateTo,
|
||||
}) = _$ProductAnalyticLoaderStateImpl;
|
||||
|
||||
@override
|
||||
ProductAnalytic get productAnalytic;
|
||||
@override
|
||||
Option<AnalyticFailure> get failureOptionProductAnalytic;
|
||||
@override
|
||||
bool get isFetching;
|
||||
@override
|
||||
DateTime get dateFrom;
|
||||
@override
|
||||
DateTime get dateTo;
|
||||
|
||||
/// Create a copy of ProductAnalyticLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$ProductAnalyticLoaderStateImplCopyWith<_$ProductAnalyticLoaderStateImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
part of 'product_analytic_loader_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class ProductAnalyticLoaderEvent with _$ProductAnalyticLoaderEvent {
|
||||
const factory ProductAnalyticLoaderEvent.rangeDateChanged(
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
) = _RangeDateChanged;
|
||||
const factory ProductAnalyticLoaderEvent.fetched() = _Fetched;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
part of 'product_analytic_loader_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class ProductAnalyticLoaderState with _$ProductAnalyticLoaderState {
|
||||
const factory ProductAnalyticLoaderState({
|
||||
required ProductAnalytic productAnalytic,
|
||||
required Option<AnalyticFailure> failureOptionProductAnalytic,
|
||||
@Default(false) bool isFetching,
|
||||
required DateTime dateFrom,
|
||||
required DateTime dateTo,
|
||||
}) = _ProductAnalyticLoaderState;
|
||||
|
||||
factory ProductAnalyticLoaderState.initial() => ProductAnalyticLoaderState(
|
||||
productAnalytic: ProductAnalytic.empty(),
|
||||
failureOptionProductAnalytic: none(),
|
||||
dateFrom: DateTime.now(),
|
||||
dateTo: DateTime.now(),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
|
||||
import '../../../domain/analytic/analytic.dart';
|
||||
import '../../../domain/analytic/repositories/i_analytic_repository.dart';
|
||||
|
||||
part 'profit_loss_loader_event.dart';
|
||||
part 'profit_loss_loader_state.dart';
|
||||
part 'profit_loss_loader_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class ProfitLossLoaderBloc
|
||||
extends Bloc<ProfitLossLoaderEvent, ProfitLossLoaderState> {
|
||||
final IAnalyticRepository _repository;
|
||||
ProfitLossLoaderBloc(this._repository)
|
||||
: super(ProfitLossLoaderState.initial()) {
|
||||
on<ProfitLossLoaderEvent>(_onProfitLossLoaderEvent);
|
||||
}
|
||||
|
||||
Future<void> _onProfitLossLoaderEvent(
|
||||
ProfitLossLoaderEvent event,
|
||||
Emitter<ProfitLossLoaderState> emit,
|
||||
) {
|
||||
return event.map(
|
||||
rangeDateChanged: (e) async {
|
||||
emit(state.copyWith(dateFrom: e.dateFrom, dateTo: e.dateTo));
|
||||
},
|
||||
fetched: (e) async {
|
||||
emit(state.copyWith(isFetching: true, failureOptionProfitLoss: none()));
|
||||
|
||||
final result = await _repository.getProfitLoss(
|
||||
dateFrom: state.dateFrom,
|
||||
dateTo: state.dateTo,
|
||||
);
|
||||
|
||||
var data = result.fold(
|
||||
(f) => state.copyWith(failureOptionProfitLoss: optionOf(f)),
|
||||
(profitLoss) => state.copyWith(profitLoss: profitLoss),
|
||||
);
|
||||
|
||||
emit(data.copyWith(isFetching: false));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,607 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'profit_loss_loader_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ProfitLossLoaderEvent {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||
rangeDateChanged,
|
||||
required TResult Function() fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult? Function()? fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult Function()? fetched,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||
required TResult Function(_Fetched value) fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult? Function(_Fetched value)? fetched,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult Function(_Fetched value)? fetched,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $ProfitLossLoaderEventCopyWith<$Res> {
|
||||
factory $ProfitLossLoaderEventCopyWith(
|
||||
ProfitLossLoaderEvent value,
|
||||
$Res Function(ProfitLossLoaderEvent) then,
|
||||
) = _$ProfitLossLoaderEventCopyWithImpl<$Res, ProfitLossLoaderEvent>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$ProfitLossLoaderEventCopyWithImpl<
|
||||
$Res,
|
||||
$Val extends ProfitLossLoaderEvent
|
||||
>
|
||||
implements $ProfitLossLoaderEventCopyWith<$Res> {
|
||||
_$ProfitLossLoaderEventCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of ProfitLossLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$RangeDateChangedImplCopyWith<$Res> {
|
||||
factory _$$RangeDateChangedImplCopyWith(
|
||||
_$RangeDateChangedImpl value,
|
||||
$Res Function(_$RangeDateChangedImpl) then,
|
||||
) = __$$RangeDateChangedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({DateTime dateFrom, DateTime dateTo});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$RangeDateChangedImplCopyWithImpl<$Res>
|
||||
extends _$ProfitLossLoaderEventCopyWithImpl<$Res, _$RangeDateChangedImpl>
|
||||
implements _$$RangeDateChangedImplCopyWith<$Res> {
|
||||
__$$RangeDateChangedImplCopyWithImpl(
|
||||
_$RangeDateChangedImpl _value,
|
||||
$Res Function(_$RangeDateChangedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of ProfitLossLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? dateFrom = null, Object? dateTo = null}) {
|
||||
return _then(
|
||||
_$RangeDateChangedImpl(
|
||||
null == dateFrom
|
||||
? _value.dateFrom
|
||||
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
null == dateTo
|
||||
? _value.dateTo
|
||||
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$RangeDateChangedImpl implements _RangeDateChanged {
|
||||
const _$RangeDateChangedImpl(this.dateFrom, this.dateTo);
|
||||
|
||||
@override
|
||||
final DateTime dateFrom;
|
||||
@override
|
||||
final DateTime dateTo;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ProfitLossLoaderEvent.rangeDateChanged(dateFrom: $dateFrom, dateTo: $dateTo)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$RangeDateChangedImpl &&
|
||||
(identical(other.dateFrom, dateFrom) ||
|
||||
other.dateFrom == dateFrom) &&
|
||||
(identical(other.dateTo, dateTo) || other.dateTo == dateTo));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, dateFrom, dateTo);
|
||||
|
||||
/// Create a copy of ProfitLossLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$RangeDateChangedImplCopyWith<_$RangeDateChangedImpl> get copyWith =>
|
||||
__$$RangeDateChangedImplCopyWithImpl<_$RangeDateChangedImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||
rangeDateChanged,
|
||||
required TResult Function() fetched,
|
||||
}) {
|
||||
return rangeDateChanged(dateFrom, dateTo);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult? Function()? fetched,
|
||||
}) {
|
||||
return rangeDateChanged?.call(dateFrom, dateTo);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult Function()? fetched,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (rangeDateChanged != null) {
|
||||
return rangeDateChanged(dateFrom, dateTo);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||
required TResult Function(_Fetched value) fetched,
|
||||
}) {
|
||||
return rangeDateChanged(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult? Function(_Fetched value)? fetched,
|
||||
}) {
|
||||
return rangeDateChanged?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult Function(_Fetched value)? fetched,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (rangeDateChanged != null) {
|
||||
return rangeDateChanged(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _RangeDateChanged implements ProfitLossLoaderEvent {
|
||||
const factory _RangeDateChanged(
|
||||
final DateTime dateFrom,
|
||||
final DateTime dateTo,
|
||||
) = _$RangeDateChangedImpl;
|
||||
|
||||
DateTime get dateFrom;
|
||||
DateTime get dateTo;
|
||||
|
||||
/// Create a copy of ProfitLossLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$RangeDateChangedImplCopyWith<_$RangeDateChangedImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$FetchedImplCopyWith<$Res> {
|
||||
factory _$$FetchedImplCopyWith(
|
||||
_$FetchedImpl value,
|
||||
$Res Function(_$FetchedImpl) then,
|
||||
) = __$$FetchedImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$FetchedImplCopyWithImpl<$Res>
|
||||
extends _$ProfitLossLoaderEventCopyWithImpl<$Res, _$FetchedImpl>
|
||||
implements _$$FetchedImplCopyWith<$Res> {
|
||||
__$$FetchedImplCopyWithImpl(
|
||||
_$FetchedImpl _value,
|
||||
$Res Function(_$FetchedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of ProfitLossLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$FetchedImpl implements _Fetched {
|
||||
const _$FetchedImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ProfitLossLoaderEvent.fetched()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType && other is _$FetchedImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(DateTime dateFrom, DateTime dateTo)
|
||||
rangeDateChanged,
|
||||
required TResult Function() fetched,
|
||||
}) {
|
||||
return fetched();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult? Function()? fetched,
|
||||
}) {
|
||||
return fetched?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
|
||||
TResult Function()? fetched,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (fetched != null) {
|
||||
return fetched();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_RangeDateChanged value) rangeDateChanged,
|
||||
required TResult Function(_Fetched value) fetched,
|
||||
}) {
|
||||
return fetched(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult? Function(_Fetched value)? fetched,
|
||||
}) {
|
||||
return fetched?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_RangeDateChanged value)? rangeDateChanged,
|
||||
TResult Function(_Fetched value)? fetched,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (fetched != null) {
|
||||
return fetched(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Fetched implements ProfitLossLoaderEvent {
|
||||
const factory _Fetched() = _$FetchedImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ProfitLossLoaderState {
|
||||
ProfitLossAnalytic get profitLoss => throw _privateConstructorUsedError;
|
||||
Option<AnalyticFailure> get failureOptionProfitLoss =>
|
||||
throw _privateConstructorUsedError;
|
||||
bool get isFetching => throw _privateConstructorUsedError;
|
||||
DateTime get dateFrom => throw _privateConstructorUsedError;
|
||||
DateTime get dateTo => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of ProfitLossLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$ProfitLossLoaderStateCopyWith<ProfitLossLoaderState> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $ProfitLossLoaderStateCopyWith<$Res> {
|
||||
factory $ProfitLossLoaderStateCopyWith(
|
||||
ProfitLossLoaderState value,
|
||||
$Res Function(ProfitLossLoaderState) then,
|
||||
) = _$ProfitLossLoaderStateCopyWithImpl<$Res, ProfitLossLoaderState>;
|
||||
@useResult
|
||||
$Res call({
|
||||
ProfitLossAnalytic profitLoss,
|
||||
Option<AnalyticFailure> failureOptionProfitLoss,
|
||||
bool isFetching,
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
});
|
||||
|
||||
$ProfitLossAnalyticCopyWith<$Res> get profitLoss;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$ProfitLossLoaderStateCopyWithImpl<
|
||||
$Res,
|
||||
$Val extends ProfitLossLoaderState
|
||||
>
|
||||
implements $ProfitLossLoaderStateCopyWith<$Res> {
|
||||
_$ProfitLossLoaderStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of ProfitLossLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? profitLoss = null,
|
||||
Object? failureOptionProfitLoss = null,
|
||||
Object? isFetching = null,
|
||||
Object? dateFrom = null,
|
||||
Object? dateTo = null,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
profitLoss: null == profitLoss
|
||||
? _value.profitLoss
|
||||
: profitLoss // ignore: cast_nullable_to_non_nullable
|
||||
as ProfitLossAnalytic,
|
||||
failureOptionProfitLoss: null == failureOptionProfitLoss
|
||||
? _value.failureOptionProfitLoss
|
||||
: failureOptionProfitLoss // ignore: cast_nullable_to_non_nullable
|
||||
as Option<AnalyticFailure>,
|
||||
isFetching: null == isFetching
|
||||
? _value.isFetching
|
||||
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
dateFrom: null == dateFrom
|
||||
? _value.dateFrom
|
||||
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
dateTo: null == dateTo
|
||||
? _value.dateTo
|
||||
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
|
||||
/// Create a copy of ProfitLossLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$ProfitLossAnalyticCopyWith<$Res> get profitLoss {
|
||||
return $ProfitLossAnalyticCopyWith<$Res>(_value.profitLoss, (value) {
|
||||
return _then(_value.copyWith(profitLoss: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ProfitLossLoaderStateImplCopyWith<$Res>
|
||||
implements $ProfitLossLoaderStateCopyWith<$Res> {
|
||||
factory _$$ProfitLossLoaderStateImplCopyWith(
|
||||
_$ProfitLossLoaderStateImpl value,
|
||||
$Res Function(_$ProfitLossLoaderStateImpl) then,
|
||||
) = __$$ProfitLossLoaderStateImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
ProfitLossAnalytic profitLoss,
|
||||
Option<AnalyticFailure> failureOptionProfitLoss,
|
||||
bool isFetching,
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
});
|
||||
|
||||
@override
|
||||
$ProfitLossAnalyticCopyWith<$Res> get profitLoss;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ProfitLossLoaderStateImplCopyWithImpl<$Res>
|
||||
extends
|
||||
_$ProfitLossLoaderStateCopyWithImpl<$Res, _$ProfitLossLoaderStateImpl>
|
||||
implements _$$ProfitLossLoaderStateImplCopyWith<$Res> {
|
||||
__$$ProfitLossLoaderStateImplCopyWithImpl(
|
||||
_$ProfitLossLoaderStateImpl _value,
|
||||
$Res Function(_$ProfitLossLoaderStateImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of ProfitLossLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? profitLoss = null,
|
||||
Object? failureOptionProfitLoss = null,
|
||||
Object? isFetching = null,
|
||||
Object? dateFrom = null,
|
||||
Object? dateTo = null,
|
||||
}) {
|
||||
return _then(
|
||||
_$ProfitLossLoaderStateImpl(
|
||||
profitLoss: null == profitLoss
|
||||
? _value.profitLoss
|
||||
: profitLoss // ignore: cast_nullable_to_non_nullable
|
||||
as ProfitLossAnalytic,
|
||||
failureOptionProfitLoss: null == failureOptionProfitLoss
|
||||
? _value.failureOptionProfitLoss
|
||||
: failureOptionProfitLoss // ignore: cast_nullable_to_non_nullable
|
||||
as Option<AnalyticFailure>,
|
||||
isFetching: null == isFetching
|
||||
? _value.isFetching
|
||||
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
dateFrom: null == dateFrom
|
||||
? _value.dateFrom
|
||||
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
dateTo: null == dateTo
|
||||
? _value.dateTo
|
||||
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$ProfitLossLoaderStateImpl implements _ProfitLossLoaderState {
|
||||
const _$ProfitLossLoaderStateImpl({
|
||||
required this.profitLoss,
|
||||
required this.failureOptionProfitLoss,
|
||||
this.isFetching = false,
|
||||
required this.dateFrom,
|
||||
required this.dateTo,
|
||||
});
|
||||
|
||||
@override
|
||||
final ProfitLossAnalytic profitLoss;
|
||||
@override
|
||||
final Option<AnalyticFailure> failureOptionProfitLoss;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool isFetching;
|
||||
@override
|
||||
final DateTime dateFrom;
|
||||
@override
|
||||
final DateTime dateTo;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ProfitLossLoaderState(profitLoss: $profitLoss, failureOptionProfitLoss: $failureOptionProfitLoss, isFetching: $isFetching, dateFrom: $dateFrom, dateTo: $dateTo)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ProfitLossLoaderStateImpl &&
|
||||
(identical(other.profitLoss, profitLoss) ||
|
||||
other.profitLoss == profitLoss) &&
|
||||
(identical(
|
||||
other.failureOptionProfitLoss,
|
||||
failureOptionProfitLoss,
|
||||
) ||
|
||||
other.failureOptionProfitLoss == failureOptionProfitLoss) &&
|
||||
(identical(other.isFetching, isFetching) ||
|
||||
other.isFetching == isFetching) &&
|
||||
(identical(other.dateFrom, dateFrom) ||
|
||||
other.dateFrom == dateFrom) &&
|
||||
(identical(other.dateTo, dateTo) || other.dateTo == dateTo));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
profitLoss,
|
||||
failureOptionProfitLoss,
|
||||
isFetching,
|
||||
dateFrom,
|
||||
dateTo,
|
||||
);
|
||||
|
||||
/// Create a copy of ProfitLossLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$ProfitLossLoaderStateImplCopyWith<_$ProfitLossLoaderStateImpl>
|
||||
get copyWith =>
|
||||
__$$ProfitLossLoaderStateImplCopyWithImpl<_$ProfitLossLoaderStateImpl>(
|
||||
this,
|
||||
_$identity,
|
||||
);
|
||||
}
|
||||
|
||||
abstract class _ProfitLossLoaderState implements ProfitLossLoaderState {
|
||||
const factory _ProfitLossLoaderState({
|
||||
required final ProfitLossAnalytic profitLoss,
|
||||
required final Option<AnalyticFailure> failureOptionProfitLoss,
|
||||
final bool isFetching,
|
||||
required final DateTime dateFrom,
|
||||
required final DateTime dateTo,
|
||||
}) = _$ProfitLossLoaderStateImpl;
|
||||
|
||||
@override
|
||||
ProfitLossAnalytic get profitLoss;
|
||||
@override
|
||||
Option<AnalyticFailure> get failureOptionProfitLoss;
|
||||
@override
|
||||
bool get isFetching;
|
||||
@override
|
||||
DateTime get dateFrom;
|
||||
@override
|
||||
DateTime get dateTo;
|
||||
|
||||
/// Create a copy of ProfitLossLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$ProfitLossLoaderStateImplCopyWith<_$ProfitLossLoaderStateImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
part of 'profit_loss_loader_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class ProfitLossLoaderEvent with _$ProfitLossLoaderEvent {
|
||||
const factory ProfitLossLoaderEvent.rangeDateChanged(
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
) = _RangeDateChanged;
|
||||
const factory ProfitLossLoaderEvent.fetched() = _Fetched;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
part of 'profit_loss_loader_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class ProfitLossLoaderState with _$ProfitLossLoaderState {
|
||||
const factory ProfitLossLoaderState({
|
||||
required ProfitLossAnalytic profitLoss,
|
||||
required Option<AnalyticFailure> failureOptionProfitLoss,
|
||||
@Default(false) bool isFetching,
|
||||
required DateTime dateFrom,
|
||||
required DateTime dateTo,
|
||||
}) = _ProfitLossLoaderState;
|
||||
|
||||
factory ProfitLossLoaderState.initial() => ProfitLossLoaderState(
|
||||
profitLoss: ProfitLossAnalytic.empty(),
|
||||
failureOptionProfitLoss: none(),
|
||||
dateFrom: DateTime.now().subtract(const Duration(days: 30)),
|
||||
dateTo: DateTime.now(),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
|
||||
import '../../../domain/analytic/analytic.dart';
|
||||
import '../../../domain/analytic/repositories/i_analytic_repository.dart';
|
||||
|
||||
part 'profit_sharing_detail_loader_event.dart';
|
||||
part 'profit_sharing_detail_loader_state.dart';
|
||||
part 'profit_sharing_detail_loader_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class ProfitSharingDetailLoaderBloc
|
||||
extends
|
||||
Bloc<ProfitSharingDetailLoaderEvent, ProfitSharingDetailLoaderState> {
|
||||
final IAnalyticRepository _repository;
|
||||
|
||||
ProfitSharingDetailLoaderBloc(this._repository)
|
||||
: super(ProfitSharingDetailLoaderState.initial()) {
|
||||
on<ProfitSharingDetailLoaderEvent>(_onProfitSharingDetailLoaderEvent);
|
||||
}
|
||||
|
||||
Future<void> _onProfitSharingDetailLoaderEvent(
|
||||
ProfitSharingDetailLoaderEvent event,
|
||||
Emitter<ProfitSharingDetailLoaderState> emit,
|
||||
) {
|
||||
return event.map(
|
||||
expandedCategoryChanged: (e) async {
|
||||
final isSame = state.expandedCategoryId == e.categoryId;
|
||||
emit(state.copyWith(expandedCategoryId: isSame ? '' : e.categoryId));
|
||||
},
|
||||
fetched: (e) async {
|
||||
emit(
|
||||
state.copyWith(
|
||||
isFetching: true,
|
||||
failureOption: none(),
|
||||
parentCategoryId: e.parentCategoryId,
|
||||
dateFrom: e.dateFrom,
|
||||
dateTo: e.dateTo,
|
||||
),
|
||||
);
|
||||
|
||||
final result = await _repository.getProfitSharingDetail(
|
||||
parentCategoryId: e.parentCategoryId,
|
||||
dateFrom: e.dateFrom,
|
||||
dateTo: e.dateTo,
|
||||
);
|
||||
|
||||
final newState = result.fold(
|
||||
(f) => state.copyWith(failureOption: optionOf(f)),
|
||||
(detail) => state.copyWith(
|
||||
detail: detail,
|
||||
// Sub kategori pertama langsung terbuka supaya produknya kelihatan.
|
||||
expandedCategoryId: detail.categories.isEmpty
|
||||
? ''
|
||||
: detail.categories.first.categoryId,
|
||||
),
|
||||
);
|
||||
|
||||
emit(newState.copyWith(isFetching: false));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,772 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'profit_sharing_detail_loader_bloc.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
|
||||
);
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ProfitSharingDetailLoaderEvent {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(
|
||||
String parentCategoryId,
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
)
|
||||
fetched,
|
||||
required TResult Function(String categoryId) expandedCategoryChanged,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(
|
||||
String parentCategoryId,
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
)?
|
||||
fetched,
|
||||
TResult? Function(String categoryId)? expandedCategoryChanged,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(
|
||||
String parentCategoryId,
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
)?
|
||||
fetched,
|
||||
TResult Function(String categoryId)? expandedCategoryChanged,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Fetched value) fetched,
|
||||
required TResult Function(_ExpandedCategoryChanged value)
|
||||
expandedCategoryChanged,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Fetched value)? fetched,
|
||||
TResult? Function(_ExpandedCategoryChanged value)? expandedCategoryChanged,
|
||||
}) => throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Fetched value)? fetched,
|
||||
TResult Function(_ExpandedCategoryChanged value)? expandedCategoryChanged,
|
||||
required TResult orElse(),
|
||||
}) => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $ProfitSharingDetailLoaderEventCopyWith<$Res> {
|
||||
factory $ProfitSharingDetailLoaderEventCopyWith(
|
||||
ProfitSharingDetailLoaderEvent value,
|
||||
$Res Function(ProfitSharingDetailLoaderEvent) then,
|
||||
) =
|
||||
_$ProfitSharingDetailLoaderEventCopyWithImpl<
|
||||
$Res,
|
||||
ProfitSharingDetailLoaderEvent
|
||||
>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$ProfitSharingDetailLoaderEventCopyWithImpl<
|
||||
$Res,
|
||||
$Val extends ProfitSharingDetailLoaderEvent
|
||||
>
|
||||
implements $ProfitSharingDetailLoaderEventCopyWith<$Res> {
|
||||
_$ProfitSharingDetailLoaderEventCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of ProfitSharingDetailLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$FetchedImplCopyWith<$Res> {
|
||||
factory _$$FetchedImplCopyWith(
|
||||
_$FetchedImpl value,
|
||||
$Res Function(_$FetchedImpl) then,
|
||||
) = __$$FetchedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String parentCategoryId, DateTime dateFrom, DateTime dateTo});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$FetchedImplCopyWithImpl<$Res>
|
||||
extends _$ProfitSharingDetailLoaderEventCopyWithImpl<$Res, _$FetchedImpl>
|
||||
implements _$$FetchedImplCopyWith<$Res> {
|
||||
__$$FetchedImplCopyWithImpl(
|
||||
_$FetchedImpl _value,
|
||||
$Res Function(_$FetchedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of ProfitSharingDetailLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? parentCategoryId = null,
|
||||
Object? dateFrom = null,
|
||||
Object? dateTo = null,
|
||||
}) {
|
||||
return _then(
|
||||
_$FetchedImpl(
|
||||
parentCategoryId: null == parentCategoryId
|
||||
? _value.parentCategoryId
|
||||
: parentCategoryId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
dateFrom: null == dateFrom
|
||||
? _value.dateFrom
|
||||
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
dateTo: null == dateTo
|
||||
? _value.dateTo
|
||||
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$FetchedImpl implements _Fetched {
|
||||
const _$FetchedImpl({
|
||||
required this.parentCategoryId,
|
||||
required this.dateFrom,
|
||||
required this.dateTo,
|
||||
});
|
||||
|
||||
@override
|
||||
final String parentCategoryId;
|
||||
@override
|
||||
final DateTime dateFrom;
|
||||
@override
|
||||
final DateTime dateTo;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ProfitSharingDetailLoaderEvent.fetched(parentCategoryId: $parentCategoryId, dateFrom: $dateFrom, dateTo: $dateTo)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$FetchedImpl &&
|
||||
(identical(other.parentCategoryId, parentCategoryId) ||
|
||||
other.parentCategoryId == parentCategoryId) &&
|
||||
(identical(other.dateFrom, dateFrom) ||
|
||||
other.dateFrom == dateFrom) &&
|
||||
(identical(other.dateTo, dateTo) || other.dateTo == dateTo));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
Object.hash(runtimeType, parentCategoryId, dateFrom, dateTo);
|
||||
|
||||
/// Create a copy of ProfitSharingDetailLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$FetchedImplCopyWith<_$FetchedImpl> get copyWith =>
|
||||
__$$FetchedImplCopyWithImpl<_$FetchedImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(
|
||||
String parentCategoryId,
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
)
|
||||
fetched,
|
||||
required TResult Function(String categoryId) expandedCategoryChanged,
|
||||
}) {
|
||||
return fetched(parentCategoryId, dateFrom, dateTo);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(
|
||||
String parentCategoryId,
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
)?
|
||||
fetched,
|
||||
TResult? Function(String categoryId)? expandedCategoryChanged,
|
||||
}) {
|
||||
return fetched?.call(parentCategoryId, dateFrom, dateTo);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(
|
||||
String parentCategoryId,
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
)?
|
||||
fetched,
|
||||
TResult Function(String categoryId)? expandedCategoryChanged,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (fetched != null) {
|
||||
return fetched(parentCategoryId, dateFrom, dateTo);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Fetched value) fetched,
|
||||
required TResult Function(_ExpandedCategoryChanged value)
|
||||
expandedCategoryChanged,
|
||||
}) {
|
||||
return fetched(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Fetched value)? fetched,
|
||||
TResult? Function(_ExpandedCategoryChanged value)? expandedCategoryChanged,
|
||||
}) {
|
||||
return fetched?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Fetched value)? fetched,
|
||||
TResult Function(_ExpandedCategoryChanged value)? expandedCategoryChanged,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (fetched != null) {
|
||||
return fetched(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Fetched implements ProfitSharingDetailLoaderEvent {
|
||||
const factory _Fetched({
|
||||
required final String parentCategoryId,
|
||||
required final DateTime dateFrom,
|
||||
required final DateTime dateTo,
|
||||
}) = _$FetchedImpl;
|
||||
|
||||
String get parentCategoryId;
|
||||
DateTime get dateFrom;
|
||||
DateTime get dateTo;
|
||||
|
||||
/// Create a copy of ProfitSharingDetailLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$FetchedImplCopyWith<_$FetchedImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ExpandedCategoryChangedImplCopyWith<$Res> {
|
||||
factory _$$ExpandedCategoryChangedImplCopyWith(
|
||||
_$ExpandedCategoryChangedImpl value,
|
||||
$Res Function(_$ExpandedCategoryChangedImpl) then,
|
||||
) = __$$ExpandedCategoryChangedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String categoryId});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ExpandedCategoryChangedImplCopyWithImpl<$Res>
|
||||
extends
|
||||
_$ProfitSharingDetailLoaderEventCopyWithImpl<
|
||||
$Res,
|
||||
_$ExpandedCategoryChangedImpl
|
||||
>
|
||||
implements _$$ExpandedCategoryChangedImplCopyWith<$Res> {
|
||||
__$$ExpandedCategoryChangedImplCopyWithImpl(
|
||||
_$ExpandedCategoryChangedImpl _value,
|
||||
$Res Function(_$ExpandedCategoryChangedImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of ProfitSharingDetailLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? categoryId = null}) {
|
||||
return _then(
|
||||
_$ExpandedCategoryChangedImpl(
|
||||
null == categoryId
|
||||
? _value.categoryId
|
||||
: categoryId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$ExpandedCategoryChangedImpl implements _ExpandedCategoryChanged {
|
||||
const _$ExpandedCategoryChangedImpl(this.categoryId);
|
||||
|
||||
@override
|
||||
final String categoryId;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ProfitSharingDetailLoaderEvent.expandedCategoryChanged(categoryId: $categoryId)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ExpandedCategoryChangedImpl &&
|
||||
(identical(other.categoryId, categoryId) ||
|
||||
other.categoryId == categoryId));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, categoryId);
|
||||
|
||||
/// Create a copy of ProfitSharingDetailLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$ExpandedCategoryChangedImplCopyWith<_$ExpandedCategoryChangedImpl>
|
||||
get copyWith =>
|
||||
__$$ExpandedCategoryChangedImplCopyWithImpl<
|
||||
_$ExpandedCategoryChangedImpl
|
||||
>(this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function(
|
||||
String parentCategoryId,
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
)
|
||||
fetched,
|
||||
required TResult Function(String categoryId) expandedCategoryChanged,
|
||||
}) {
|
||||
return expandedCategoryChanged(categoryId);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function(
|
||||
String parentCategoryId,
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
)?
|
||||
fetched,
|
||||
TResult? Function(String categoryId)? expandedCategoryChanged,
|
||||
}) {
|
||||
return expandedCategoryChanged?.call(categoryId);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function(
|
||||
String parentCategoryId,
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
)?
|
||||
fetched,
|
||||
TResult Function(String categoryId)? expandedCategoryChanged,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (expandedCategoryChanged != null) {
|
||||
return expandedCategoryChanged(categoryId);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(_Fetched value) fetched,
|
||||
required TResult Function(_ExpandedCategoryChanged value)
|
||||
expandedCategoryChanged,
|
||||
}) {
|
||||
return expandedCategoryChanged(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(_Fetched value)? fetched,
|
||||
TResult? Function(_ExpandedCategoryChanged value)? expandedCategoryChanged,
|
||||
}) {
|
||||
return expandedCategoryChanged?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(_Fetched value)? fetched,
|
||||
TResult Function(_ExpandedCategoryChanged value)? expandedCategoryChanged,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (expandedCategoryChanged != null) {
|
||||
return expandedCategoryChanged(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _ExpandedCategoryChanged
|
||||
implements ProfitSharingDetailLoaderEvent {
|
||||
const factory _ExpandedCategoryChanged(final String categoryId) =
|
||||
_$ExpandedCategoryChangedImpl;
|
||||
|
||||
String get categoryId;
|
||||
|
||||
/// Create a copy of ProfitSharingDetailLoaderEvent
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$ExpandedCategoryChangedImplCopyWith<_$ExpandedCategoryChangedImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$ProfitSharingDetailLoaderState {
|
||||
ProfitSharingDetail get detail => throw _privateConstructorUsedError;
|
||||
Option<AnalyticFailure> get failureOption =>
|
||||
throw _privateConstructorUsedError;
|
||||
bool get isFetching => throw _privateConstructorUsedError;
|
||||
String get parentCategoryId => throw _privateConstructorUsedError;
|
||||
String get expandedCategoryId => throw _privateConstructorUsedError;
|
||||
DateTime get dateFrom => throw _privateConstructorUsedError;
|
||||
DateTime get dateTo => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of ProfitSharingDetailLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$ProfitSharingDetailLoaderStateCopyWith<ProfitSharingDetailLoaderState>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $ProfitSharingDetailLoaderStateCopyWith<$Res> {
|
||||
factory $ProfitSharingDetailLoaderStateCopyWith(
|
||||
ProfitSharingDetailLoaderState value,
|
||||
$Res Function(ProfitSharingDetailLoaderState) then,
|
||||
) =
|
||||
_$ProfitSharingDetailLoaderStateCopyWithImpl<
|
||||
$Res,
|
||||
ProfitSharingDetailLoaderState
|
||||
>;
|
||||
@useResult
|
||||
$Res call({
|
||||
ProfitSharingDetail detail,
|
||||
Option<AnalyticFailure> failureOption,
|
||||
bool isFetching,
|
||||
String parentCategoryId,
|
||||
String expandedCategoryId,
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
});
|
||||
|
||||
$ProfitSharingDetailCopyWith<$Res> get detail;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$ProfitSharingDetailLoaderStateCopyWithImpl<
|
||||
$Res,
|
||||
$Val extends ProfitSharingDetailLoaderState
|
||||
>
|
||||
implements $ProfitSharingDetailLoaderStateCopyWith<$Res> {
|
||||
_$ProfitSharingDetailLoaderStateCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of ProfitSharingDetailLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? detail = null,
|
||||
Object? failureOption = null,
|
||||
Object? isFetching = null,
|
||||
Object? parentCategoryId = null,
|
||||
Object? expandedCategoryId = null,
|
||||
Object? dateFrom = null,
|
||||
Object? dateTo = null,
|
||||
}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
detail: null == detail
|
||||
? _value.detail
|
||||
: detail // ignore: cast_nullable_to_non_nullable
|
||||
as ProfitSharingDetail,
|
||||
failureOption: null == failureOption
|
||||
? _value.failureOption
|
||||
: failureOption // ignore: cast_nullable_to_non_nullable
|
||||
as Option<AnalyticFailure>,
|
||||
isFetching: null == isFetching
|
||||
? _value.isFetching
|
||||
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
parentCategoryId: null == parentCategoryId
|
||||
? _value.parentCategoryId
|
||||
: parentCategoryId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
expandedCategoryId: null == expandedCategoryId
|
||||
? _value.expandedCategoryId
|
||||
: expandedCategoryId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
dateFrom: null == dateFrom
|
||||
? _value.dateFrom
|
||||
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
dateTo: null == dateTo
|
||||
? _value.dateTo
|
||||
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
}
|
||||
|
||||
/// Create a copy of ProfitSharingDetailLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$ProfitSharingDetailCopyWith<$Res> get detail {
|
||||
return $ProfitSharingDetailCopyWith<$Res>(_value.detail, (value) {
|
||||
return _then(_value.copyWith(detail: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$ProfitSharingDetailLoaderStateImplCopyWith<$Res>
|
||||
implements $ProfitSharingDetailLoaderStateCopyWith<$Res> {
|
||||
factory _$$ProfitSharingDetailLoaderStateImplCopyWith(
|
||||
_$ProfitSharingDetailLoaderStateImpl value,
|
||||
$Res Function(_$ProfitSharingDetailLoaderStateImpl) then,
|
||||
) = __$$ProfitSharingDetailLoaderStateImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({
|
||||
ProfitSharingDetail detail,
|
||||
Option<AnalyticFailure> failureOption,
|
||||
bool isFetching,
|
||||
String parentCategoryId,
|
||||
String expandedCategoryId,
|
||||
DateTime dateFrom,
|
||||
DateTime dateTo,
|
||||
});
|
||||
|
||||
@override
|
||||
$ProfitSharingDetailCopyWith<$Res> get detail;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$ProfitSharingDetailLoaderStateImplCopyWithImpl<$Res>
|
||||
extends
|
||||
_$ProfitSharingDetailLoaderStateCopyWithImpl<
|
||||
$Res,
|
||||
_$ProfitSharingDetailLoaderStateImpl
|
||||
>
|
||||
implements _$$ProfitSharingDetailLoaderStateImplCopyWith<$Res> {
|
||||
__$$ProfitSharingDetailLoaderStateImplCopyWithImpl(
|
||||
_$ProfitSharingDetailLoaderStateImpl _value,
|
||||
$Res Function(_$ProfitSharingDetailLoaderStateImpl) _then,
|
||||
) : super(_value, _then);
|
||||
|
||||
/// Create a copy of ProfitSharingDetailLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? detail = null,
|
||||
Object? failureOption = null,
|
||||
Object? isFetching = null,
|
||||
Object? parentCategoryId = null,
|
||||
Object? expandedCategoryId = null,
|
||||
Object? dateFrom = null,
|
||||
Object? dateTo = null,
|
||||
}) {
|
||||
return _then(
|
||||
_$ProfitSharingDetailLoaderStateImpl(
|
||||
detail: null == detail
|
||||
? _value.detail
|
||||
: detail // ignore: cast_nullable_to_non_nullable
|
||||
as ProfitSharingDetail,
|
||||
failureOption: null == failureOption
|
||||
? _value.failureOption
|
||||
: failureOption // ignore: cast_nullable_to_non_nullable
|
||||
as Option<AnalyticFailure>,
|
||||
isFetching: null == isFetching
|
||||
? _value.isFetching
|
||||
: isFetching // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
parentCategoryId: null == parentCategoryId
|
||||
? _value.parentCategoryId
|
||||
: parentCategoryId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
expandedCategoryId: null == expandedCategoryId
|
||||
? _value.expandedCategoryId
|
||||
: expandedCategoryId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
dateFrom: null == dateFrom
|
||||
? _value.dateFrom
|
||||
: dateFrom // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
dateTo: null == dateTo
|
||||
? _value.dateTo
|
||||
: dateTo // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$ProfitSharingDetailLoaderStateImpl
|
||||
extends _ProfitSharingDetailLoaderState {
|
||||
const _$ProfitSharingDetailLoaderStateImpl({
|
||||
required this.detail,
|
||||
required this.failureOption,
|
||||
this.isFetching = false,
|
||||
this.parentCategoryId = '',
|
||||
this.expandedCategoryId = '',
|
||||
required this.dateFrom,
|
||||
required this.dateTo,
|
||||
}) : super._();
|
||||
|
||||
@override
|
||||
final ProfitSharingDetail detail;
|
||||
@override
|
||||
final Option<AnalyticFailure> failureOption;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool isFetching;
|
||||
@override
|
||||
@JsonKey()
|
||||
final String parentCategoryId;
|
||||
@override
|
||||
@JsonKey()
|
||||
final String expandedCategoryId;
|
||||
@override
|
||||
final DateTime dateFrom;
|
||||
@override
|
||||
final DateTime dateTo;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ProfitSharingDetailLoaderState(detail: $detail, failureOption: $failureOption, isFetching: $isFetching, parentCategoryId: $parentCategoryId, expandedCategoryId: $expandedCategoryId, dateFrom: $dateFrom, dateTo: $dateTo)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$ProfitSharingDetailLoaderStateImpl &&
|
||||
(identical(other.detail, detail) || other.detail == detail) &&
|
||||
(identical(other.failureOption, failureOption) ||
|
||||
other.failureOption == failureOption) &&
|
||||
(identical(other.isFetching, isFetching) ||
|
||||
other.isFetching == isFetching) &&
|
||||
(identical(other.parentCategoryId, parentCategoryId) ||
|
||||
other.parentCategoryId == parentCategoryId) &&
|
||||
(identical(other.expandedCategoryId, expandedCategoryId) ||
|
||||
other.expandedCategoryId == expandedCategoryId) &&
|
||||
(identical(other.dateFrom, dateFrom) ||
|
||||
other.dateFrom == dateFrom) &&
|
||||
(identical(other.dateTo, dateTo) || other.dateTo == dateTo));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
detail,
|
||||
failureOption,
|
||||
isFetching,
|
||||
parentCategoryId,
|
||||
expandedCategoryId,
|
||||
dateFrom,
|
||||
dateTo,
|
||||
);
|
||||
|
||||
/// Create a copy of ProfitSharingDetailLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$ProfitSharingDetailLoaderStateImplCopyWith<
|
||||
_$ProfitSharingDetailLoaderStateImpl
|
||||
>
|
||||
get copyWith =>
|
||||
__$$ProfitSharingDetailLoaderStateImplCopyWithImpl<
|
||||
_$ProfitSharingDetailLoaderStateImpl
|
||||
>(this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _ProfitSharingDetailLoaderState
|
||||
extends ProfitSharingDetailLoaderState {
|
||||
const factory _ProfitSharingDetailLoaderState({
|
||||
required final ProfitSharingDetail detail,
|
||||
required final Option<AnalyticFailure> failureOption,
|
||||
final bool isFetching,
|
||||
final String parentCategoryId,
|
||||
final String expandedCategoryId,
|
||||
required final DateTime dateFrom,
|
||||
required final DateTime dateTo,
|
||||
}) = _$ProfitSharingDetailLoaderStateImpl;
|
||||
const _ProfitSharingDetailLoaderState._() : super._();
|
||||
|
||||
@override
|
||||
ProfitSharingDetail get detail;
|
||||
@override
|
||||
Option<AnalyticFailure> get failureOption;
|
||||
@override
|
||||
bool get isFetching;
|
||||
@override
|
||||
String get parentCategoryId;
|
||||
@override
|
||||
String get expandedCategoryId;
|
||||
@override
|
||||
DateTime get dateFrom;
|
||||
@override
|
||||
DateTime get dateTo;
|
||||
|
||||
/// Create a copy of ProfitSharingDetailLoaderState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$ProfitSharingDetailLoaderStateImplCopyWith<
|
||||
_$ProfitSharingDetailLoaderStateImpl
|
||||
>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
part of 'profit_sharing_detail_loader_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class ProfitSharingDetailLoaderEvent with _$ProfitSharingDetailLoaderEvent {
|
||||
const factory ProfitSharingDetailLoaderEvent.fetched({
|
||||
required String parentCategoryId,
|
||||
required DateTime dateFrom,
|
||||
required DateTime dateTo,
|
||||
}) = _Fetched;
|
||||
|
||||
/// Buka/tutup daftar produk pada satu sub kategori.
|
||||
const factory ProfitSharingDetailLoaderEvent.expandedCategoryChanged(
|
||||
String categoryId,
|
||||
) = _ExpandedCategoryChanged;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
part of 'profit_sharing_detail_loader_bloc.dart';
|
||||
|
||||
@freezed
|
||||
class ProfitSharingDetailLoaderState with _$ProfitSharingDetailLoaderState {
|
||||
const ProfitSharingDetailLoaderState._();
|
||||
|
||||
const factory ProfitSharingDetailLoaderState({
|
||||
required ProfitSharingDetail detail,
|
||||
required Option<AnalyticFailure> failureOption,
|
||||
@Default(false) bool isFetching,
|
||||
@Default('') String parentCategoryId,
|
||||
@Default('') String expandedCategoryId,
|
||||
required DateTime dateFrom,
|
||||
required DateTime dateTo,
|
||||
}) = _ProfitSharingDetailLoaderState;
|
||||
|
||||
factory ProfitSharingDetailLoaderState.initial() {
|
||||
final now = DateTime.now();
|
||||
return ProfitSharingDetailLoaderState(
|
||||
detail: ProfitSharingDetail.empty(),
|
||||
failureOption: none(),
|
||||
dateFrom: DateTime(now.year, now.month, 1),
|
||||
dateTo: DateTime(now.year, now.month + 1, 0),
|
||||
);
|
||||
}
|
||||
|
||||
bool isExpanded(String categoryId) => expandedCategoryId == categoryId;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
|
||||
import '../../../domain/analytic/analytic.dart';
|
||||
import '../../../domain/analytic/repositories/i_analytic_repository.dart';
|
||||
|
||||
part 'profit_sharing_loader_event.dart';
|
||||
part 'profit_sharing_loader_state.dart';
|
||||
part 'profit_sharing_loader_bloc.freezed.dart';
|
||||
|
||||
@injectable
|
||||
class ProfitSharingLoaderBloc
|
||||
extends Bloc<ProfitSharingLoaderEvent, ProfitSharingLoaderState> {
|
||||
final IAnalyticRepository _repository;
|
||||
|
||||
ProfitSharingLoaderBloc(this._repository)
|
||||
: super(ProfitSharingLoaderState.initial()) {
|
||||
on<ProfitSharingLoaderEvent>(_onProfitSharingLoaderEvent);
|
||||
}
|
||||
|
||||
Future<void> _onProfitSharingLoaderEvent(
|
||||
ProfitSharingLoaderEvent event,
|
||||
Emitter<ProfitSharingLoaderState> emit,
|
||||
) {
|
||||
return event.map(
|
||||
rangeDateChanged: (e) async {
|
||||
emit(state.copyWith(dateFrom: e.dateFrom, dateTo: e.dateTo));
|
||||
},
|
||||
periodTypeChanged: (e) async {
|
||||
emit(state.copyWith(periodType: e.periodType));
|
||||
},
|
||||
fetched: (e) async {
|
||||
emit(state.copyWith(isFetching: true, failureOption: none()));
|
||||
|
||||
final result = await _repository.getProfitSharing(
|
||||
dateFrom: state.dateFrom,
|
||||
dateTo: state.dateTo,
|
||||
);
|
||||
|
||||
final newState = result.fold(
|
||||
(f) => state.copyWith(failureOption: optionOf(f)),
|
||||
(profitSharing) => state.copyWith(profitSharing: profitSharing),
|
||||
);
|
||||
|
||||
emit(newState.copyWith(isFetching: false));
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||