type 'Null' is not a subtype of type 'GenericFunctionTypeElement' in type cast at offset <number> #53330
Labels
area-migration (deprecated)
Deprecated: this label is no longer actively used (was: issues with the `dart migrate` tool).
Flutter : 3.7.0, Dart : 2.9
While running the dart migrate tool to migrate to null-safety got this error.
type 'Null' is not a subtype of type 'GenericFunctionTypeElement' in type cast at offset 857 in .../lib/app_specific_utils/_core/app_cloud_provider.dart (DioError)
#0 EdgeBuilder.visitNamedType (package:nnbd_migration/src/edge_builder.dart:1488:36)
#1 NamedTypeImpl.accept (package:analyzer/src/dart/ast/ast.dart:9003:50)
#2 EdgeBuilder._dispatch (package:nnbd_migration/src/edge_builder.dart:2375:24)
#3 EdgeBuilder.visitCatchClause (package:nnbd_migration/src/edge_builder.dart:666:5)
#4 CatchClauseImpl.accept (package:analyzer/src/dart/ast/ast.dart:1708:50)
#5 EdgeBuilder._dispatch (package:nnbd_migration/src/edge_builder.dart:2375:24)
#6 EdgeBuilder._dispatchList (package:nnbd_migration/src/edge_builder.dart:2393:7)
#7 EdgeBuilder.visitTryStatement (package:nnbd_migration/src/edge_builder.dart:2001:7)
#8 TryStatementImpl.accept (package:analyzer/src/dart/ast/ast.dart:12926:50)
#9 EdgeBuilder._dispatch (package:nnbd_migration/src/edge_builder.dart:2375:24)
#10 EdgeBuilder.visitNode (package:nnbd_migration/src/edge_builder.dart:1567:9)
#11 GeneralizingAstVisitor.visitStatement (package:analyzer/dart/ast/visitor.dart:649:40)
#12 GeneralizingAstVisitor.visitBlock (package:analyzer/dart/ast/visitor.dart:170:32)
#13 BlockImpl.accept (package:analyzer/src/dart/ast/ast.dart:1260:50)
#14 EdgeBuilder._dispatch (package:nnbd_migration/src/edge_builder.dart:2375:24)
#15 EdgeBuilder.visitNode (package:nnbd_migration/src/edge_builder.dart:1567:9)
#16 GeneralizingAstVisitor.visitFunctionBody (package:analyzer/dart/ast/visitor.dart:362:46)
#17 GeneralizingAstVisitor.visitBlockFunctionBody (package:analyzer/dart/ast/visitor.dart:173:56)
#18 BlockFunctionBodyImpl.accept (package:analyzer/src/dart/ast/ast.dart:1207:50)
#19 EdgeBuilder._dispatch (package:nnbd_migration/src/edge_builder.dart:2375:24)
#20 EdgeBuilder._handleExecutableDeclaration (package:nnbd_migration/src/edge_builder.dart:2682:7)
#21 EdgeBuilder.visitMethodDeclaration (package:nnbd_migration/src/edge_builder.dart:1393:5)
#22 MethodDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:8533:50)
#23 EdgeBuilder._dispatch (package:nnbd_migration/src/edge_builder.dart:2375:24)
#24 EdgeBuilder._dispatchList (package:nnbd_migration/src/edge_builder.dart:2393:7)
#25 EdgeBuilder.visitClassOrMixinOrExtensionDeclaration (package:nnbd_migration/src/edge_builder.dart:717:7)
#26 EdgeBuilder.visitClassDeclaration (package:nnbd_migration/src/edge_builder.dart:676:5)
#27 ClassDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:2000:50)
#28 EdgeBuilder._dispatch (package:nnbd_migration/src/edge_builder.dart:2375:24)
#29 EdgeBuilder.visitNode (package:nnbd_migration/src/edge_builder.dart:1567:9)
#30 GeneralizingAstVisitor.visitCompilationUnit (package:analyzer/dart/ast/visitor.dart:216:52)
#31 CompletenessTracker.visitCompilationUnit. (package:nnbd_migration/src/utilities/completeness_tracker.dart:52:24)
#32 PermissiveModeVisitor.reportExceptionsIfPermissive (package:nnbd_migration/src/utilities/permissive_mode.dart:26:24)
#33 CompletenessTracker.visitCompilationUnit (package:nnbd_migration/src/utilities/completeness_tracker.dart:43:5)
#34 CompilationUnitImpl.accept (package:analyzer/src/dart/ast/ast.dart:2501:50)
#35 NullabilityMigrationImpl.processInput (package:nnbd_migration/src/nullability_migration_impl.dart:224:12)
#36 NonNullableFix.processUnit (package:nnbd_migration/src/front_end/non_nullable_fix.dart:162:16)
#37 _FixCodeProcessor.runLaterPhases. (package:nnbd_migration/migration_cli.dart:1088:19)
#38 _FixCodeProcessor.processResources (package:nnbd_migration/migration_cli.dart:1020:26)
#39 _FixCodeProcessor.runLaterPhases (package:nnbd_migration/migration_cli.dart:1086:5)
#40 MigrationCliRunner.run (package:nnbd_migration/migration_cli.dart:695:24)
#41 MigrateCommand.run (package:dartdev/src/commands/migrate.dart:37:7)
#42 CommandRunner.runCommand (package:args/command_runner.dart:212:13)
#43 DartdevRunner.runCommand (package:dartdev/dartdev.dart:241:18)
#44 runDartdev (package:dartdev/dartdev.dart:65:18)
#45 main (file:///opt/s/w/ir/x/w/sdk/pkg/dartdev/bin/dartdev.dart:11:3)
========================================================================
The file at the path is
abstract class AppCloudProvider
extends BaseApiProvider {
var path = "";
Dio _apiClient;
AppCloudProvider(this.path, this._apiClient);
@OverRide
Future<AppResponse> delete(T item) async {
try {
var response = await _apiClient.delete("$path/${item.uniqueId}");
return AppResponse(data: response.data);
} on DioError catch (e) {
return ApiHelper.processErrorInDioServerResponse(e);
}
}
@OverRide
Future<AppResponse> update(T item) async {
try {
var data = toMap(item);
var response = await apiClient.post(updatePath(), data: data);
try {
Map<String, dynamic> data = response.data;
if (data[AppColumn.code] == 1) {
return AppResponse(data: item);
} else {
return AppResponse(
data: null, error: ErrorResponse.fromResponse(response));
}
} catch (e) {
return ApiHelper.processErrorInParsing(e);
}
} on DioError catch (e) {
print(e.message);
return ApiHelper.processErrorInDioServerResponse(e);
}
}
String updatePath() => path;
@OverRide
Future<AppResponse> add(T item) async {
return update(item);
// try {
// var response =
// await _apiClient.post("$path/${item.uniqueId}", data: toMap(item));
// return AppResponse(data: response.data);
// } on DioError catch (e) {
// return ApiHelper.processErrorInDioServerResponse(e);
// }
}
@OverRide
Future addItems(List items) =>
throw Exception("not implemented");
@OverRide
Future updateItems(List items)=>
throw Exception("not implemented");
@OverRide
Future<AppResponse> fetch(String id) async {
try {
var response = await _apiClient.get(updateFetchPath(id));
}
@OverRide
Future<AppResponse<AppListManager>> fetchItems(
{List orderBy,
int limitBy,
int startFrom,
List where,
bool isClearOldItems = false,
Map<String, dynamic> options}) async {
// print("$this --fetching items");
}
@OverRide
Map<String, dynamic> toMap(T item) {
return item.toMap();
}
/// override this method if response doesn't contains direct list of items
List processItemsFromResponse(data, Map<String, dynamic> secondaryInfo) {
List items = (data as List).map((record) {
var item = fromMap(record);
return item;
}).toList();
return items;
}
Dio get apiClient => _apiClient;
String updateFetchPath(String id) {
return "$path/$id";
}
}
The text was updated successfully, but these errors were encountered: