After adding a get:^4.6.1 I got the below error.
Code:
class MyApp extends StatelessWidget {
// This widget is the root of your application.
#override
Widget build(BuildContext context) {
return GetMaterialApp(
title: 'Flutter web One',
home: HomePage(),
);
}
}
Error:
const CupertinoApp({
^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.6.1/lib/get_navigation/src/root/get_material_app.dart:275:17: Error: No named parameter with the name 'useInheritedMediaQuery'.
useInheritedMediaQuery: useInheritedMediaQuery,
^^^^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/packages/flutter/lib/src/material/app.dart:217:9: Context: Found this candidate, but the arguments don't match.
const MaterialApp.router({
^^^^^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.6.1/lib/get_navigation/src/root/get_material_app.dart:322:17: Error: No named parameter with the name 'useInheritedMediaQuery'.
useInheritedMediaQuery: useInheritedMediaQuery,
^^^^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/packages/flutter/lib/src/material/app.dart:166:9: Context: Found this candidate, but the arguments don't match.
const MaterialApp({
^^^^^^^^^^^
and also if I try to downgrade getx version 4.6.1 to 4.3.8 still i am getting the same error and in the error, it shows get-4.6.1 version.
The above problem is happening in get version >= 4.6.0. Use the exact version below 4.6.0 withing using ^ sign, which upgrades the package to the maximum compatible version.
In pubspec.yaml use get package like below:
get: 4.5.1 #Don't use ^
Related
I'm trying to create an app that performs a Firebase authorization on a desktop.
I didn't find any full sample code for this so I started by create a basic demo project on VScode.
As soon as I add the package flutter pub add firebase_auth_desktop (without adding code to the app), I get errors when I try to run the app.
/C:/Users/yvan_/AppData/Local/Pub/Cache/hosted/pub.dev/firebase_core-1.24.0/lib/src/firebase_app.dart(18,25): error G75B77105: Member not found: 'FirebaseAppPlatform.verifyExtends'.
[C:\FDSTiming\Project\Flutter\app3\build\windows\flutter\flutter_assemble.vcxproj]
/C:/Users/yvan_/AppData/Local/Pub/Cache/hosted/pub.dev/firebase_auth_platform_interface-6.10.1/lib/src/action_code_info.dart(65,15): error GE5CFE876: The method 'FallThroughError' isn't defined for the class 'ActionCodeInfo'. [C:\FDSTiming\Project\Flutter\app3\build\windows\flutter\flutter_assemble.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(247,5): error MSB8066: Custom build for 'C:\FDSTiming\Project\Flutter\app3\build\windows\CMakeFiles\18de2b4c67371752531dc30d7008f913\flutter_windows.dll.rule;C:\FDSTiming\Project\Flutter\app3\build\windows\CMakeFiles\122a37675ed5a5d637290377de62a3e1\flutter_assemble.rule;C:\FDSTiming\Project\Flutter\app3\windows\flutter\CMakeLists.txt' exited with code 1. [C:\FDSTiming\Project\Flutter\app3\build\windows\flutter\flutter_assemble.vcxproj]
Exception: Build process failed.
The code is:
import 'package:flutter/material.dart';
//import 'package:firebase_auth_desktop/firebase_auth_desktop.dart';
void main() {
runApp(const MainApp());
}
class MainApp extends StatelessWidget {
const MainApp({super.key});
#override
Widget build(BuildContext context) {
return const MaterialApp(
home: Scaffold(
body: Center(
child: Text('Hello World!'),
),
),
);
}
}
And pubspec.yaml:
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
firebase_auth_desktop: ^1.0.2
Any idea?
I managed to get rid of the first error by adding:
firebase_core_platform_interface: 4.5.1
firebase_messaging: ^13.0.4
But didn't find any clues for the others errors
The flutter firebase_core dependency currently not supported by windows platform.
The flutter team has given the following flutter project created by them, to learn from. https://github.com/flutter/codelabs/tree/main/boring_to_beautiful
through their codelab.
I cloned the repo and tried to start the app. But it throws the following error.
════════ Exception caught by widgets library
The following assertion was thrown building IconTheme(color: Color(0xdd000000)):
This GoRouteInformationParser needs to be used with GoRouteInformationProvider, did you forget to pass in GoRouter.routeInformationProvider to the Router constructor?
'package:go_router/src/go_route_information_parser.dart':
package:go_router/src/go_route_information_parser.dart:1
Failed assertion: line 148 pos 13: 'routeInformation is DebugGoRouteInformation'
From this error msg, I could understand that 'routeInformationProvider' seems to be missing. But is that possible in a working demo project given by the flutter team to learn from? Should I pass the routeInformationProvider? if so any docs, please.
Just add routeInformationProvider to MaterialApp.router.
Example:
final _router = GoRouter(
...
);
#override
Widget build(BuildContext context) {
return MaterialApp.router(
routeInformationProvider: _router.routeInformationProvider,
...
);
}
I also had this problem, but with the go_router version: ^4.1.0 and following this guide the problem is solved.
Edit: - This should not be marked as the correct answer, as it was just a workaround. Please mark Luca Iaconelli answer as the correct one
Previous answer:
Just go back to version 3.1.1 of GoRouter. It seems latest version has an issue
Add routeinformationProvider at MaterialApp root:
MaterialApp.router(
routeInformationProvider: goRouter.routeInformationProvider,//Add this line
routerDelegate: goRouter.routerDelegate,
routeInformationParser: goRouter.routeInformationParser,
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.amber,
),
);
For me, it was solved when I added
the following line of code
routeInformationProvider: _router.routeInformationProvider,
before the following two lines of codes
routeInformationParser: goRouter.routeInformationParser,
routerDelegate: goRouter.routerDelegate,
Platform -
Flutter 1.24.0-10.2.pre • channel dev • https://github.com/flutter/flutter.git
Framework • revision 022b333a08 (8 days ago) • 2020-11-18 11:35:09 -0800
Engine • revision 07c1eed46b
Tools • Dart 2.12.0 (build 2.12.0-29.10.beta)
SRC -
import 'package:flutter/material.dart';
void main() => runApp(
DevicePreview(
builder: (context) => MyApp(), // Wrap your app
),
);
class MyApp extends StatelessWidget {
#override
Widget build(BuildContext context) {
return MaterialApp(
locale: DevicePreview.locale(context), // Add the locale here
builder: DevicePreview.appBuilder, // Add the builder here
home: Text("Home Page"),
);
}
}
Error -
Running "flutter pub get" in xyz...
Launching lib/main.dart on Chrome in debug mode...
lib/main.dart:1
../../../../../.pub-cache/hosted/pub.dartlang.org/device_preview-0.5.5/lib/src/views/device_preview_style.dart:86:42: Error: No named parameter with the name 'nullOk'.
final media = MediaQuery.of(context, nullOk: true) ??
^^^^^^
../../../../../development/flutter/packages/flutter/lib/src/widgets/media_query.dart:814:25: Context: Found this candidate, but the arguments don't match.
static MediaQueryData of(BuildContext context) {
^^
Failed to compile application.
Exited (sigterm)
Tried on a Pixel device also, doesn't work.
Opened issue - https://github.com/aloisdeniel/flutter_device_preview/issues/91
The reason for this issue was that Flutter removed the nullOk parameter in MediaQuery that's being used by the device_preview plugin as mentioned on this issue thread. An update for the plugin has been rolled out to fix the issue.
i recently started learning flutter. I was working on the 'package:english_words/english_words.dart' package. I have successfully imported it by modifying the pubspec.yaml file by adding 'english_words: ^3.1.0 inside dependencies and on the main.dart file child:Text(wordPair.asPascalCase) is throwing an error. The output I got after running it is :
Compiler message:
lib/main.dart:17:23: Error: Getter not found: 'wordPair'.
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
build failed.
FAILURE: Build failed with an exception.
Where:
Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 780
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command 'C:\flutter\bin\flutter.bat'' finished with non-zero exit value 1
and here is my code:
import 'package:flutter/material.dart';
import 'package:english_words/english_words.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
#override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Welcome to Flutter',
home: Scaffold(
appBar: AppBar(
title: const Text('Welcome to Flutter'),
),
body: const Center(
child: Text(wordPair.asPascalCase),
),
),
);
}
}
my english.dart file is
/// Support for working with English text.
library english_words;
export 'src/syllables.dart';
export 'src/word_pair.dart';
export 'src/words/adjectives.dart';
export 'src/words/all.dart';
export 'src/words/nouns.dart';
This file comes from the flutter package, you won't have to modify it.
library english_words;
export 'src/syllables.dart';
export 'src/word_pair.dart';
export 'src/words/adjectives.dart';
export 'src/words/all.dart';
export 'src/words/nouns.dart';
The problem is the understanding of the english_words package. Using wordPair makes no sense since you didn't declared it.
You can't access the asPascalCase getter with a static instance of WordPair. So you will have to create an instance of WordPair and then use the pascalCase getter.
import 'package:english_words/english_words.dart';
var wordpair = WordPair("first,", "second");
String pascalCase = wordpair.asPascalCase;
The working code for this question is also available here
i tryed testdrive for flutter installed on windows as here https://flutter.dev/docs/get-started/test-drive
defaut application generated work, well, but when i try to follow the snd part at
https://flutter.dev/docs/get-started/codelab
i get errors:
error: The function 'MyApp' isn't defined. (undefined_function at [flutter_app007] lib\main.dart:3)
error: 'MaterialApp' isn't a function. (invocation_of_non_function at [flutter_app007] lib\main.dart:8)
error: 'Scaffold' isn't a function. (invocation_of_non_function at [flutter_app007] lib\main.dart:10)
error: 'AppBar' isn't a function. (invocation_of_non_function at [flutter_app007] lib\main.dart:11)
for this code in main.dart
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
#override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Welcome to Flutter',
home: Scaffold(
appBar: AppBar(
title: const Text('Welcome to Flutter'),
),
body: const Center(
child: const Text('Hello World'),
),
),
);
}
}
i checked flutter doctor, but show nothing bad.. any idea?
go to the project directory and open windows cmd. and try flutter run
ok, i finally resolved the problem.
when i was typed 'flutter_console.bat', i was get after, 'mysql is unknow program '. i finally founded that an install of MySQL Fabric 1.5 & MySQL Utilities 1.5\ setted his path in PATH env variable. this path poisonned result path integration , returning 'mysql is unknow program' and stopping project generation.. . desinstalling the mysql software solved the problem by cleaning path from his entry and now, the project can be created and work as expected..
very strange, no..?