Null safety

This commit is contained in:
Hillel Coren 2023-10-01 17:44:26 +03:00
parent be31e0c9da
commit f8225112ab
11 changed files with 5 additions and 38 deletions

View File

@ -133,7 +133,6 @@ abstract class UserEntity extends Object
customValue2: '',
customValue3: '',
customValue4: '',
userCompany: userCompany,
oauthProvider: '',
isTwoFactorEnabled: false,
hasPassword: false,
@ -141,6 +140,7 @@ abstract class UserEntity extends Object
oauthUserToken: '',
password: '',
phoneVerified: false,
userCompany: userCompany ?? UserCompanyEntity(false),
);
}
@ -332,6 +332,7 @@ abstract class UserEntity extends Object
// ignore: unused_element
static void _initializeBuilder(UserEntityBuilder builder) => builder
..userCompany.replace(UserCompanyEntity(false))
..isTwoFactorEnabled = false
..hasPassword = false
..phoneVerified = false

View File

@ -147,10 +147,6 @@ SettingsEntity getClientSettings(AppState? state, ClientEntity? client) {
}
SettingsEntity getVendorSettings(AppState state, VendorEntity? vendor) {
if (state == null) {
return SettingsEntity();
}
vendor ??= VendorEntity();
final company = state.company!;
//final group = state.groupState.get(vendor.groupId);

View File

@ -194,16 +194,6 @@ UserCompanyEntity loadCompanySuccessReducer(
UserCompanyEntity? company, LoadCompanySuccess action) {
var userCompany = action.userCompany;
// Check user has a blank user settings object
if (userCompany.settings == null) {
userCompany = userCompany.rebuild((b) => b
..settings.replace(UserSettingsEntity())
..user
.userCompany
.notifications
.replace(BuiltMap<String, BuiltList<String>>()));
}
userCompany = userCompany.rebuild((b) => b.company
..taskStatuses.replace(<TaskStatusEntity>[])
..taskStatusMap.replace(BuiltMap<String, TaskStatusEntity>())

View File

@ -45,9 +45,6 @@ Future<void> showEntityActionsDialog(
{required List<BaseEntity?> entities,
Completer? completer,
bool multiselect = false}) async {
if (entities == null) {
return;
}
final mainContext = navigatorKey.currentContext;
final state = StoreProvider.of<AppState>(navigatorKey.currentContext!).state;
final actions = <Widget>[];

View File

@ -125,7 +125,6 @@ class EntityStatusChip extends StatelessWidget {
break;
default:
return SizedBox();
break;
}
label = localization!.lookup(label) ?? '';

View File

@ -154,7 +154,7 @@ class InvoiceItemListTile extends StatelessWidget {
SizedBox(width: 1),
],
),
trailing: onTap != null ? Icon(Icons.navigate_next) : null,
trailing: Icon(Icons.navigate_next),
),
ListDivider(),
],

View File

@ -296,7 +296,7 @@ class AppPaginatedDataTableState extends State<AppPaginatedDataTable> {
DataRow? row;
if (index < _rowCount || _rowCountApproximate) {
row = _rows.putIfAbsent(index, () => widget.source.getRow(index));
if (row == null && !haveProgressIndicator) {
if (!haveProgressIndicator) {
row = _getProgressIndicatorRowFor(index);
haveProgressIndicator = true;
}

View File

@ -60,17 +60,6 @@ class EntityDataTableSource extends AppDataTableSource {
final listState = state.getListState(entityType);
final uIState = state.getUIState(entityType);
if (entity == null) {
return DataRow(cells: [
DataCell(SizedBox()),
...tableColumns!.map(
(field) => DataCell(
SizedBox(),
),
)
]);
}
bool isSelected = false;
if (!listState.isInMultiselect() &&
(state.prefState.isPreviewVisible || state.uiState.isEditing)) {

View File

@ -753,8 +753,6 @@ class DashboardPanels extends StatelessWidget {
case DashboardSections.runningTasks:
return runningTasks!;
}
return SizedBox();
},
),
),

View File

@ -95,9 +95,6 @@ class DashboardVM {
isLoading: state.isLoading,
onRefreshed: (context) => _handleRefresh(context),
onEntityTypeChanged: (entityType) {
if (entityType == null) {
return;
}
store.dispatch(UpdateDashboardEntityType(entityType: entityType));
},
onSettingsChanged: (DashboardSettings settings) =>

View File

@ -61,7 +61,7 @@ class ExpenseListItem extends StatelessWidget {
String subtitle = '';
if (filterMatch != null) {
subtitle = filterMatch;
} else if (client != null || vendor != null || category != null) {
} else {
final parts = <String>[
formatDate(expense.date, context),
];