master #81
@ -35,7 +35,7 @@ class AlbumsScreen extends BlocScreen<AlbumBloc, AlbumEvent, AlbumState> {
|
|||||||
bloc..add(AlbumFetched());
|
bloc..add(AlbumFetched());
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget onWrap(BuildContext context, Widget child) => AlbumsWrapperWidget(
|
Widget parent(BuildContext context, Widget child) => AlbumsWrapperWidget(
|
||||||
child: child,
|
child: child,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ class PhotoDetailsScreen
|
|||||||
bloc..load(photoId);
|
bloc..load(photoId);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget onWrap(BuildContext context, Widget child) =>
|
Widget parent(BuildContext context, Widget child) =>
|
||||||
PhotoDetailsWrapperWidget(child: child);
|
PhotoDetailsWrapperWidget(child: child);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -37,7 +37,7 @@ class PhotosScreen extends BlocScreen<PhotoBloc, PhotoEvent, PhotoState> {
|
|||||||
bloc..add(PhotoFetched(albumId));
|
bloc..add(PhotoFetched(albumId));
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget onWrap(BuildContext context, Widget child) => PhotosWrapperWidget(
|
Widget parent(BuildContext context, Widget child) => PhotosWrapperWidget(
|
||||||
child: child,
|
child: child,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ class EditProfileCubit extends FormDataCubitImpl {
|
|||||||
status: FormStatus.submissionInProgress,
|
status: FormStatus.submissionInProgress,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
final user = (await authenticationRepository.getAccount()).ok;
|
// final user = (await authenticationRepository.getAccount()).ok;
|
||||||
|
|
||||||
final form = state.form;
|
final form = state.form;
|
||||||
final email = form.valueOf<String?>(AuthFormField.email);
|
final email = form.valueOf<String?>(AuthFormField.email);
|
||||||
|
@ -20,6 +20,6 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
BlocOverrides.runZoned(() => runApp(const CounterRepositoryProviderPage()),
|
Bloc.observer = CounterObserver();
|
||||||
blocObserver: CounterObserver());
|
runApp(const CounterRepositoryProviderPage());
|
||||||
}
|
}
|
||||||
|
@ -7,24 +7,24 @@ class ExampleCubit extends Cubit<CrudState> {
|
|||||||
|
|
||||||
FutureOr<void> run() async {
|
FutureOr<void> run() async {
|
||||||
while (true) {
|
while (true) {
|
||||||
await Future.delayed(const Duration(seconds: 1));
|
await Future<void>.delayed(const Duration(seconds: 1));
|
||||||
emit(CrudLoading());
|
emit(CrudLoading());
|
||||||
await Future.delayed(const Duration(seconds: 1));
|
await Future<void>.delayed(const Duration(seconds: 1));
|
||||||
emit(const CrudError('Cubit Error'));
|
emit(const CrudError('Cubit Error'));
|
||||||
await Future.delayed(const Duration(seconds: 1));
|
await Future<void>.delayed(const Duration(seconds: 1));
|
||||||
emit(const CrudLoaded<String>('DATA LOADED'));
|
emit(const CrudLoaded<String>('DATA LOADED'));
|
||||||
await Future.delayed(const Duration(seconds: 1));
|
await Future<void>.delayed(const Duration(seconds: 1));
|
||||||
emit(CrudInitial());
|
emit(CrudInitial());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FutureOr<void> runList() async {
|
FutureOr<void> runList() async {
|
||||||
while (true) {
|
while (true) {
|
||||||
await Future.delayed(const Duration(seconds: 1));
|
await Future<void>.delayed(const Duration(seconds: 1));
|
||||||
emit(CrudLoading());
|
emit(CrudLoading());
|
||||||
await Future.delayed(const Duration(seconds: 1));
|
await Future<void>.delayed(const Duration(seconds: 1));
|
||||||
emit(const CrudError('Cubit Error'));
|
emit(const CrudError('Cubit Error'));
|
||||||
await Future.delayed(const Duration(seconds: 1));
|
await Future<void>.delayed(const Duration(seconds: 1));
|
||||||
emit(
|
emit(
|
||||||
const CrudListLoaded<String>([
|
const CrudListLoaded<String>([
|
||||||
'DATA LOADED 1',
|
'DATA LOADED 1',
|
||||||
@ -33,7 +33,7 @@ class ExampleCubit extends Cubit<CrudState> {
|
|||||||
'DATA LOADED 4'
|
'DATA LOADED 4'
|
||||||
]),
|
]),
|
||||||
);
|
);
|
||||||
await Future.delayed(const Duration(seconds: 1));
|
await Future<void>.delayed(const Duration(seconds: 1));
|
||||||
emit(CrudInitial());
|
emit(CrudInitial());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,10 +21,6 @@ import 'package:form_bloc_example/app/bloc_observer.dart';
|
|||||||
|
|
||||||
Future<void> main() async {
|
Future<void> main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
BlocOverrides.runZoned(
|
Bloc.observer = AppBlocObserver();
|
||||||
() => runApp(
|
runApp(const App());
|
||||||
const App(),
|
|
||||||
),
|
|
||||||
blocObserver: AppBlocObserver(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ Future<void> handleDigest(HttpRequest req) async {
|
|||||||
Future<void> handleUnsafe(HttpRequest req) async {
|
Future<void> handleUnsafe(HttpRequest req) async {
|
||||||
print(
|
print(
|
||||||
'Query parameters => '
|
'Query parameters => '
|
||||||
'${req.uri.queryParameters.toString()}',
|
'${req.uri.queryParameters}',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,8 +82,8 @@ class VerifyCode {
|
|||||||
VerifyCode.fromMap(json.decode(source) as Map<String, dynamic>);
|
VerifyCode.fromMap(json.decode(source) as Map<String, dynamic>);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() =>
|
String toString() => 'VerifyCode(email: $email, verificationCode: '
|
||||||
'VerifyCode(email: $email, verificationCode: $verificationCode, action: $action)';
|
'$verificationCode, action: $action)';
|
||||||
}
|
}
|
||||||
|
|
||||||
class Account {
|
class Account {
|
||||||
@ -198,8 +198,8 @@ class TokenSuccess {
|
|||||||
TokenSuccess.fromMap(json.decode(source) as Map<String, dynamic>);
|
TokenSuccess.fromMap(json.decode(source) as Map<String, dynamic>);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() =>
|
String toString() => 'TokenSuccess(accessToken: $accessToken, refreshToken: '
|
||||||
'TokenSuccess(accessToken: $accessToken, refreshToken: $refreshToken, account: $account)';
|
'$refreshToken, account: $account)';
|
||||||
}
|
}
|
||||||
|
|
||||||
class Login {
|
class Login {
|
||||||
@ -353,19 +353,19 @@ void main(List<String> args) async {
|
|||||||
);
|
);
|
||||||
|
|
||||||
await api.sendSignUpCode('git@pcl.ovh');
|
await api.sendSignUpCode('git@pcl.ovh');
|
||||||
final verifiedAccount = await api.verifyCode(
|
// final verifiedAccount = await api.verifyCode(
|
||||||
VerifyCode(
|
// VerifyCode(
|
||||||
email: 'git@pcl.ovh',
|
// email: 'git@pcl.ovh',
|
||||||
verificationCode: '000000000',
|
// verificationCode: '000000000',
|
||||||
action: EmailVerificationAction.signUp,
|
// action: EmailVerificationAction.signUp,
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
final registeredAccount = await api.signUp(
|
// final registeredAccount = await api.signUp(
|
||||||
SignUp(sessionId: verifiedAccount.sessionId ?? '', password: 'password'),
|
// SignUp(sessionId: verifiedAccount.sessionId ?? '', password: 'password'),
|
||||||
);
|
// );
|
||||||
final signedInAccount = await api.signInWithPassword(
|
// final signedInAccount = await api.signInWithPassword(
|
||||||
Login(email: 'git@pcl.ovh', password: 'password'),
|
// Login(email: 'git@pcl.ovh', password: 'password'),
|
||||||
);
|
// );
|
||||||
final accountList = await api.getAccountList();
|
final accountList = await api.getAccountList();
|
||||||
print(accountList);
|
print(accountList);
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,8 @@ import 'package:wyatt_http_client/src/utils/protocols.dart';
|
|||||||
// BaseResponse onResponse(BaseResponse response) {
|
// BaseResponse onResponse(BaseResponse response) {
|
||||||
// final res = child?.onResponse(response) ?? response;
|
// final res = child?.onResponse(response) ?? response;
|
||||||
// print(
|
// print(
|
||||||
// 'RequestMutator::OnResponse: ${res.statusCode} -> ${res.contentLength} bytes',
|
// 'RequestMutator::OnResponse: ${res.statusCode} -> ${res.contentLength}
|
||||||
|
// bytes',
|
||||||
// );
|
// );
|
||||||
// return res;
|
// return res;
|
||||||
// }
|
// }
|
||||||
@ -75,7 +76,8 @@ import 'package:wyatt_http_client/src/utils/protocols.dart';
|
|||||||
// if (response != null) return response;
|
// if (response != null) return response;
|
||||||
|
|
||||||
// return Future.sync(() => innerHandler(request))
|
// return Future.sync(() => innerHandler(request))
|
||||||
// .then((response) => responseHandler!(response), onError: onError);
|
// .then((response) => responseHandler!(response), onError:
|
||||||
|
// onError);
|
||||||
// });
|
// });
|
||||||
// };
|
// };
|
||||||
// };
|
// };
|
||||||
|
@ -30,6 +30,8 @@ class Pipeline {
|
|||||||
/// Add a [Middleware] to this [Pipeline]
|
/// Add a [Middleware] to this [Pipeline]
|
||||||
Pipeline addMiddleware(Middleware middleware) {
|
Pipeline addMiddleware(Middleware middleware) {
|
||||||
_middlewares.add(middleware);
|
_middlewares.add(middleware);
|
||||||
|
// TODO(hpcl): use Dart cascades instead of returning this
|
||||||
|
// ignore: avoid_returning_this
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user