Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ linter:
rules:
one_member_abstracts: false
only_throw_errors: false
public_member_api_docs: false
public_member_api_docs: false
document_ignores: false
unreachable_from_main: false
4 changes: 4 additions & 0 deletions packages/clean_framework/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Changelog
## 4.1.3
**Jan 12, 2026**
- Bump dependency to latest version.

## 4.1.2
**Sep 17, 2024**
- Bump dependency to latest version.
Expand Down
2 changes: 2 additions & 0 deletions packages/clean_framework/example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
*.swp
.DS_Store
.atom/
.build/
.buildlog/
.history
.svn/
.swiftpm/
migrate_working_dir/

# IntelliJ related
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:clean_framework/clean_framework.dart';
import 'package:dio/dio.dart';

final restClientProvider = DependencyProvider(
final DependencyProvider<Dio> restClientProvider = DependencyProvider(
(_) => Dio(BaseOptions(baseUrl: 'https://pokeapi.co/api/v2/')),
);
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:async';

import 'package:clean_framework/clean_framework.dart';
import 'package:clean_framework_example_rest/features/form/domain/form_domain_models.dart';
import 'package:clean_framework_example_rest/features/form/domain/form_use_case.dart';
Expand All @@ -14,7 +16,7 @@ class FormPresenter

@override
void onLayoutReady(BuildContext context, FormUseCase useCase) {
useCase.fetchAndPrefillData();
unawaited(useCase.fetchAndPrefillData());
}

@override
Expand All @@ -37,34 +39,36 @@ class FormPresenter
FormDomainToUIModel domainModel,
) {
if (domainModel.isLoggedIn) {
showDialog<void>(
context: context,
barrierDismissible: false,
builder: (context) {
final meta = domainModel.userMeta;
unawaited(
showDialog<void>(
context: context,
barrierDismissible: false,
builder: (context) {
final meta = domainModel.userMeta;

return AlertDialog(
title: const Text('Login Success'),
content: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text('Email: ${meta.email}'),
Text('Password: ${meta.password}'),
Text('Gender: ${meta.gender}'),
],
),
actions: [
FilledButton(
onPressed: () {
Navigator.pop(context);
Navigator.pop(context);
},
child: const Text('Done'),
return AlertDialog(
title: const Text('Login Success'),
content: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text('Email: ${meta.email}'),
Text('Password: ${meta.password}'),
Text('Gender: ${meta.gender}'),
],
),
],
);
},
actions: [
FilledButton(
onPressed: () {
Navigator.pop(context);
Navigator.pop(context);
},
child: const Text('Done'),
),
],
);
},
),
);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:async';

import 'package:clean_framework/clean_framework.dart';
import 'package:clean_framework_example_rest/features/home/domain/home_domain_models.dart';
import 'package:clean_framework_example_rest/features/home/domain/home_entity.dart';
Expand All @@ -15,7 +17,7 @@ class HomePresenter

@override
void onLayoutReady(BuildContext context, HomeUseCase useCase) {
useCase.fetchPokemons();
unawaited(useCase.fetchPokemons());
}

@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ class ProfileUseCase extends UseCase<ProfileEntity> {

final String name;

void fetchPokemonProfile() {
Future<void> fetchPokemonProfile() async {
final pokeName = name.toLowerCase();

// If the use case is not auto disposed then we have last fetched data.
if (entity.description.isNotEmpty) return;

request<PokemonSpeciesSuccessDomainInput>(
await request<PokemonSpeciesSuccessDomainInput>(
PokemonSpeciesDomainToGatewayModel(name: pokeName),
onSuccess: (success) {
final descriptions = success.species.descriptions.where(
Expand All @@ -38,7 +38,7 @@ class ProfileUseCase extends UseCase<ProfileEntity> {
onFailure: (failure) => entity,
);

request<PokemonProfileSuccessInput>(
await request<PokemonProfileSuccessInput>(
PokemonProfileDomainToGatewayModel(name: pokeName),
onSuccess: (success) {
final profile = success.profile;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:async';

import 'package:clean_framework/clean_framework.dart';
import 'package:clean_framework_example_rest/features/profile/domain/profile_domain_models.dart';
import 'package:clean_framework_example_rest/features/profile/domain/profile_use_case.dart';
Expand All @@ -16,7 +18,7 @@ class ProfilePresenter extends Presenter<ProfileViewModel,
@override
@protected
void onLayoutReady(BuildContext context, ProfileUseCase useCase) {
useCase.fetchPokemonProfile();
unawaited(useCase.fetchPokemonProfile());
}

@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import 'package:clean_framework/clean_framework.dart';
import 'package:clean_framework_example_rest/core/pokemon/pokemon_external_interface.dart';
import 'package:clean_framework_example_rest/providers/gateway_providers.dart';

final pokemonExternalInterfaceProvider = ExternalInterfaceProvider(
final ExternalInterfaceProvider<PokemonExternalInterface>
pokemonExternalInterfaceProvider = ExternalInterfaceProvider(
PokemonExternalInterface.new,
gateways: [
pokemonCollectionGateway,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,21 @@ import 'package:clean_framework_example_rest/features/profile/external_interface
import 'package:clean_framework_example_rest/features/profile/external_interface/pokemon_species_gateway.dart';
import 'package:clean_framework_example_rest/providers/use_case_providers.dart';

final pokemonCollectionGateway = GatewayProvider(
final GatewayProvider<PokemonCollectionGateway> pokemonCollectionGateway =
GatewayProvider(
PokemonCollectionGateway.new,
useCases: [homeUseCaseProvider],
);

final pokemonProfileGateway = GatewayProvider(
final GatewayProvider<PokemonProfileGateway> pokemonProfileGateway =
GatewayProvider(
PokemonProfileGateway.new,
useCases: [],
families: [profileUseCaseFamily],
);

final pokemonSpeciesGateway = GatewayProvider(
final GatewayProvider<PokemonSpeciesGateway> pokemonSpeciesGateway =
GatewayProvider(
PokemonSpeciesGateway.new,
useCases: [],
families: [profileUseCaseFamily],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:clean_framework_example_rest/features/home/domain/home_use_case.
import 'package:clean_framework_example_rest/features/profile/domain/profile_entity.dart';
import 'package:clean_framework_example_rest/features/profile/domain/profile_use_case.dart';

final homeUseCaseProvider =
final AutoDisposeUseCaseProvider<HomeEntity, HomeUseCase> homeUseCaseProvider =
UseCaseProvider.autoDispose<HomeEntity, HomeUseCase>(
HomeUseCase.new,
(bridge) {
Expand All @@ -24,7 +24,8 @@ final homeUseCaseProvider =
},
);

final profileUseCaseFamily =
final UseCaseProviderFamily<ProfileEntity, ProfileUseCase, String>
profileUseCaseFamily =
UseCaseProvider.family<ProfileEntity, ProfileUseCase, String>(
ProfileUseCase.new,
);
Expand Down
3 changes: 2 additions & 1 deletion packages/clean_framework/example/lib/widgets/spotlight.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'dart:async';
import 'dart:math';

import 'package:clean_framework_example_rest/widgets/app_scope.dart';
Expand Down Expand Up @@ -36,7 +37,7 @@ class _SpotlightState extends State<Spotlight> {
void initState() {
super.initState();
SchedulerBinding.instance.addPostFrameCallback((_) {
_loadFileFromCache();
unawaited(_loadFileFromCache());
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,17 @@ class _SvgPaletteCardState extends State<SvgPaletteCard> {
void initState() {
super.initState();
SchedulerBinding.instance.addPostFrameCallback((_) {
_fetchSvg();
unawaited(_fetchSvg());
});
}

@override
void didUpdateWidget(SvgPaletteCard oldWidget) {
super.didUpdateWidget(oldWidget);
if (oldWidget.url != widget.url) {
_fetchSvg();
unawaited(_fetchSvg());
}
_generateColor();
unawaited(_generateColor());
}

@override
Expand Down Expand Up @@ -102,7 +102,7 @@ class _SvgPaletteCardState extends State<SvgPaletteCard> {
if (mounted) setState(() {});

unawaited(_generateColor());
} catch (e) {
} on Exception catch (e) {
log(e.toString(), name: 'SvgPaletteCard');
}
}
Expand Down
8 changes: 4 additions & 4 deletions packages/clean_framework/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ environment:

dependencies:
animations: ^2.0.11
clean_framework: ^4.1.1
clean_framework_router: ^0.5.11
clean_framework: ^4.1.3
clean_framework_router: ^0.5.13
dio: ^5.7.0
flutter:
sdk: flutter
Expand All @@ -19,12 +19,12 @@ dependencies:
uniform: ^2.0.6

dev_dependencies:
clean_framework_test: ^0.5.3
clean_framework_test: ^0.5.4
file: ^7.0.0
flutter_test:
sdk: flutter
http: ^1.2.2
icons_launcher: ^2.1.7
icons_launcher: ^3.0.3
mocktail: ^1.0.4

flutter:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ void main() {
when(() => useCase.fetchPokemons(isRefresh: true))
.thenAnswer((_) async {});
},
verify: (useCase, vm) {
vm.onRefresh();
verify: (useCase, vm) async {
await vm.onRefresh();

verify(() => useCase.fetchPokemons(isRefresh: true));
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ void main() {
useCaseTest<ProfileUseCase, ProfileEntity, ProfileDomainToUIModel>(
'fetches pokemon profile',
provider: profileUseCaseFamily('pikachu'),
execute: (useCase) {
useCase
execute: (useCase) async {
final profileUseCase = useCase
..subscribe<PokemonSpeciesDomainToGatewayModel,
PokemonSpeciesSuccessDomainInput>(
(output) {
Expand Down Expand Up @@ -55,8 +55,8 @@ void main() {
),
);
},
)
..fetchPokemonProfile();
);
await profileUseCase.fetchPokemonProfile();
},
expect: () => [
const ProfileDomainToUIModel(
Expand Down Expand Up @@ -86,8 +86,8 @@ void main() {
useCaseTest<ProfileUseCase, ProfileEntity, ProfileDomainToUIModel>(
'fetches pokemon profile; description failure',
provider: profileUseCaseFamily('PIKACHU'),
execute: (useCase) {
useCase
execute: (useCase) async {
final profileUseCase = useCase
..subscribe<PokemonSpeciesDomainToGatewayModel,
PokemonSpeciesSuccessDomainInput>(
(output) {
Expand Down Expand Up @@ -118,8 +118,8 @@ void main() {
),
);
},
)
..fetchPokemonProfile();
);
await profileUseCase.fetchPokemonProfile();
},
expect: () => [
const ProfileDomainToUIModel(
Expand All @@ -142,8 +142,8 @@ void main() {
useCaseTest<ProfileUseCase, ProfileEntity, ProfileDomainToUIModel>(
'fetches pokemon profile; profile/stat failure',
provider: profileUseCaseFamily('PIKACHU'),
execute: (useCase) {
useCase
execute: (useCase) async {
final profileUseCase = useCase
..subscribe<PokemonSpeciesDomainToGatewayModel,
PokemonSpeciesSuccessDomainInput>(
(output) {
Expand All @@ -168,8 +168,8 @@ void main() {
FailureDomainInput(message: 'Something went wrong'),
);
},
)
..fetchPokemonProfile();
);
await profileUseCase.fetchPokemonProfile();
},
expect: () => [
const ProfileDomainToUIModel(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore_for_file: lines_longer_than_80_chars

import 'package:clean_framework/clean_framework.dart';
import 'package:clean_framework_example_rest/core/pokemon/pokemon_success_response.dart';
import 'package:clean_framework_example_rest/features/profile/domain/profile_domain_models.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ class ProfileUseCaseFake extends ProfileUseCase {
ProfileUseCaseFake(super.name);

@override
void fetchPokemonProfile() {}
Future<void> fetchPokemonProfile() async {}
}
2 changes: 0 additions & 2 deletions packages/clean_framework/example/test/flow_test.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore_for_file: lines_longer_than_80_chars

import 'package:clean_framework/clean_framework.dart';
import 'package:clean_framework_example_rest/core/pokemon/pokemon_external_interface.dart';
import 'package:clean_framework_example_rest/core/pokemon/pokemon_request.dart';
Expand Down
Loading
Loading