opt: unnecessary_non_null_assertion (#1762)

This commit is contained in:
My-Responsitories
2025-12-03 17:35:42 +08:00
committed by GitHub
parent b7a277a57c
commit 2b3ec77e92
89 changed files with 249 additions and 247 deletions

View File

@@ -67,8 +67,8 @@ abstract class CommonWhisperController<R>
if (res.isSuccess) {
if (loadingState.value.isSuccess) {
List<Session>? list = loadingState.value.data;
if (list?.isNotEmpty == true) {
for (var item in list!) {
if (list != null && list.isNotEmpty) {
for (var item in list) {
if (item.hasUnread()) {
item.clearUnread();
}

View File

@@ -149,9 +149,9 @@ abstract class CommonDynPageState<T extends StatefulWidget> extends State<T>
itemBuilder: (context, index) => const VideoReplySkeleton(),
),
Success(:var response) =>
response?.isNotEmpty == true
response != null && response.isNotEmpty
? SliverList.builder(
itemCount: response!.length + 1,
itemCount: response.length + 1,
itemBuilder: (context, index) {
if (index == response.length) {
controller.onLoadMore();

View File

@@ -93,8 +93,8 @@ mixin CommonMultiSelectMixin<T extends MultiSelectData>
void handleSelect({bool checked = false, bool disableSelect = true}) {
if (loadingState.value.isSuccess) {
final list = loadingState.value.data;
if (list?.isNotEmpty == true) {
for (var item in list!) {
if (list != null && list.isNotEmpty) {
for (var item in list) {
item.checked = checked;
}
loadingState.refresh();
@@ -165,7 +165,7 @@ mixin DeleteItemMixin<R, T extends MultiSelectData>
// void handleSelect([bool checked = false, bool disableSelect = true]) {
// if (loadingState.value.isSuccess) {
// final list = loadingState.value.data;
// if (list?.isNotEmpty == true) {
// if (list != null && list.isNotEmpty) {
// if (checked) {
// selected.addAll(list!.map(getId));
// } else {

View File

@@ -95,8 +95,8 @@ abstract class CommonSearchPageState<S extends StatefulWidget, R, T>
return switch (loadingState) {
Loading() => const HttpError(),
Success(:var response) =>
response?.isNotEmpty == true
? buildList(response!)
response != null && response.isNotEmpty
? buildList(response)
: HttpError(onReload: controller.onReload),
Error(:var errMsg) => HttpError(
errMsg: errMsg,