Hello, I have been working on an app for some time now and have made several custom functions and actions. All of a sudden, automatic imports are no longer recognized, among a plethora of other issues. Imports are a problem for all new actions and functions, I have no idea what has changed...
Error received when building (all of the functions and actions pass the checks on the web, but not the desktop app):
63 packages have newer versions incompatible with dependency constraints.
Try flutter pub outdated
for more information.
Launching lib/main.dart on Web Server in debug mode...
Waiting for connection from debug service on Web Server...
Warning: In index.html:52: Local variable for "serviceWorkerVersion" is deprecated. Use "{{flutter_service_worker_version}}" template token instead.
Warning: In index.html:67: "FlutterLoader.loadEntrypoint" is deprecated. Use "FlutterLoader.load" instead.
lib/home_page/home_page_widget.dart:383:78: Error: The argument type 'List<List<int>>' can't be assigned to the parameter type 'List<int>'.
- 'List' is from 'dart:core'.
.toList(),
^
lib/home_page/home_page_widget.dart:387:78: Error: The argument type 'List<List<int>>' can't be assigned to the parameter type 'List<int>'.
- 'List' is from 'dart:core'.
.toList())
^
lib/home_page/home_page_widget.dart:407:143: Error: The argument type 'List<List<int>>' can't be assigned to the parameter type 'List<int>'.
- 'List' is from 'dart:core'.
progressBarStatisticsRecordList.map((e) => e.numShouldComplete).toList(),
^
lib/home_page/home_page_widget.dart:408:138: Error: The argument type 'List<List<int>>' can't be assigned to the parameter type 'List<int>'.
- 'List' is from 'dart:core'.
progressBarStatisticsRecordList.map((e) => e.numCompleted).toList()),
^
Waiting for connection from debug service on Web Server... 65.2s
Failed to compile application.
The functions all spit out this error:
'FakeDocumentReference.snapshots' ('Stream<DocumentSnapshot<Object?>> Function({bool includeMetadataChanges})') isn't a valid override of 'DocumentReference.snapshots' ('Stream<DocumentSnapshot<Object?>> Function({bool includeMetadataChanges, ListenSource source})').
Function Example that yielded the error:
int getDay() {
/// MODIFY CODE ONLY BELOW THIS LINE
// function that returns the current day as an integer minus one.
DateTime now = DateTime.now();
int day = now.day - 1;
return day;
/// MODIFY CODE ONLY ABOVE THIS LINE
}
As far as the actions go, it is even more peculiar:
Error: Failed running flutter pub get...
Note: intl is pinned to version 0.19.0 by flutter_localizations from the flutter SDK.
See https://dart.dev/go/sdk-version-pinning for details.
Because custom_widget depends on flutter_localizations from sdk which depends on intl 0.19.0, intl 0.19.0 is required.
So, because custom_widget depends on intl 0.18.1, version solving failed.
You can try the following suggestion to make the pubspec resolve:
* Try upgrading your constraint on intl: flutter pub add intl:^0.19.0
Here is an example of the action that yielded this result:
int getNum(int index, int value, String arrayName) async {
return 1;
}
Thank you very much for any insight you can offer!