fix orders parsing

This commit is contained in:
Inex Code 2022-12-27 08:45:05 +03:00
parent 5a31e25b73
commit 66ef4e99d8
4 changed files with 40 additions and 2 deletions

View file

@ -0,0 +1,25 @@
// Generated file.
//
// If you wish to remove Flutter's multidex support, delete this entire file.
//
// Modifications to this file should be done in a copy under a different name
// as this file may be regenerated.
package io.flutter.app;
import android.app.Application;
import android.content.Context;
import androidx.annotation.CallSuper;
import androidx.multidex.MultiDex;
/**
* Extension of {@link android.app.Application}, adding multidex support.
*/
public class FlutterMultiDexApplication extends Application {
@Override
@CallSuper
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}

View file

@ -7,6 +7,9 @@ import 'package:hive_flutter/hive_flutter.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:selfprivacy/logic/appsettingscubit.dart'; import 'package:selfprivacy/logic/appsettingscubit.dart';
import 'package:selfprivacy/logic/courierscubit.dart';
import 'package:selfprivacy/logic/itemscubit.dart';
import 'package:selfprivacy/logic/orderscubit.dart';
final GetIt getIt = GetIt.instance; final GetIt getIt = GetIt.instance;
@ -112,6 +115,15 @@ class BlocAndProviderConfig extends StatelessWidget {
BlocProvider( BlocProvider(
create: (final _) => AppSettingsCubit(key: '')..load(), create: (final _) => AppSettingsCubit(key: '')..load(),
), ),
BlocProvider(
create: (final _) => ItemsCubit()..load(),
),
BlocProvider(
create: (final _) => CouriersCubit()..load(),
),
BlocProvider(
create: (final _) => OrdersCubit()..load(),
),
], ],
child: child, child: child,
); );

View file

@ -35,6 +35,7 @@ class Order {
final String address; final String address;
final String status; final String status;
final int id; final int id;
@JsonKey(name: 'courier_id')
final int courierId; final int courierId;
final List<Item> items; final List<Item> items;

View file

@ -16,7 +16,7 @@ Order _$OrderFromJson(Map<String, dynamic> json) => Order(
deliveryDate: json['delivery_date'] as String, deliveryDate: json['delivery_date'] as String,
address: json['address'] as String, address: json['address'] as String,
status: json['status'] as String, status: json['status'] as String,
courierId: json['courierId'] as int, courierId: json['courier_id'] as int,
items: (json['items'] as List<dynamic>) items: (json['items'] as List<dynamic>)
.map((e) => Item.fromJson(e as Map<String, dynamic>)) .map((e) => Item.fromJson(e as Map<String, dynamic>))
.toList(), .toList(),
@ -32,6 +32,6 @@ Map<String, dynamic> _$OrderToJson(Order instance) => <String, dynamic>{
'address': instance.address, 'address': instance.address,
'status': instance.status, 'status': instance.status,
'id': instance.id, 'id': instance.id,
'courierId': instance.courierId, 'courier_id': instance.courierId,
'items': instance.items, 'items': instance.items,
}; };