lib/database/database_helper.dart:54:51: Error: The argument type 'Map<dynamic, dynamic>' can't be assigned to the parameter type 'Map<String, dynamic>'.
- 'Map' is from 'dart:core'. return notes.map((e) => NoteModel.fromMap(e) ); ^ lib/database/database_helper.dart:54:22: Error: Method 'map' cannot be called on 'List<Map<dynamic, dynamic>>?' because it is potentially null.
- 'List' is from 'dart:core'.
- 'Map' is from 'dart:core'. Try calling using ?. instead. return notes.map((e) => NoteModel.fromMap(e) ); ^^^ lib/database/database_helper.dart:54:22: Error: A value of type 'Iterable' can't be returned from an async function with return type 'Future<List?>'.
- 'Iterable' is from 'dart:core'.
- 'NoteModel' is from 'package:note_sql_db/model/note.dart' ('lib/model/note.dart').
- 'Future' is from 'dart:async'.
- 'List' is from 'dart:core'. return notes.map((e) => NoteModel.fromMap(e) ); ^
FAILURE: Build failed with an exception.
Where: Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1070
What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command 'C:\flutter\bin\flutter.bat'' finished with non-zero exit value 1
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 1m 25s Exception: Gradle task assembleDebug failed with exit code 1
CodePudding user response:
Simply add a .toList()
will solve the problem of A value of type 'Iterable<NoteModel>' can't be returned from an async function with return type 'Future<List<NoteModel>?>'
.
Please format your question and provide your code.
CodePudding user response:
The argument type 'Map<dynamic, dynamic>' can't be assigned to the parameter type 'Map<String, dynamic>'.
lib/database/database_helper.dart:54:46: Error: The argument type 'Map<dynamic, dynamic>' can't be assigned to the parameter type 'Map<String, dynamic>'.
- 'Map' is from 'dart:core'. notes?.map((e) => NoteModel.fromMap(e).toMap() );
" This is showing now"