Flutter Doctor
[√] Flutter (Channel stable, 2.0.3, on Microsoft Windows [Version 10.0.19042.985], locale en-US)
• Flutter version 2.0.3 at C:\flutter
• Framework revision 4d7946a68d (2 months ago), 2021-03-18 17:24:33 -0700
• Engine revision 3459eb2436
• Dart version 2.12.2
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\Anas\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 4.1.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
[√] VS Code (version 1.56.2)
• VS Code at C:\Users\Anas\AppData\Local\Programs\Microsoft VS Code
• Flutter extension can be installed from:
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (3 available)
• SM A305F (mobile) • R58M78MVZNJ • android-arm64 • Android 10 (API 29)
• Chrome (web) • chrome • web-javascript • Google Chrome 90.0.4430.212
• Edge (web) • edge • web-javascript • Microsoft Edge 91.0.864.37
• No issues found!
Main Activity Code For Understanding
import 'package:flutter/material.dart';
import 'package:hungers_den/ui/display_screen.dart';
import 'package:hungers_den/ui/splash_screen.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
#override
Widget build(BuildContext context) {
return MaterialApp(
initialRoute: '/splashScreen',
debugShowCheckedModeBanner: false,
routes: {
'/splashScreen': (context) => SplashScreen(),
'/displayScreen': (context) => DisplayScreen(),
},
);
}
}
Actual code where the problem is (onend function of animation container not being called)
import 'package:flutter/material.dart';
import 'package:hungers_den/colors.dart';
class SplashScreen extends StatelessWidget {
#override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: primaryAppColor,
body: Center(
child: AnimatedContainer(
width: 350,
height: 300,
curve: Curves.easeInOutQuint,
decoration: BoxDecoration(
gradient: RadialGradient(
colors: [Colors.yellow, Colors.transparent],
)),
child: Image.asset("assets/images/logo/hungersden-logo.png",
width: 150, height: 150),
duration: Duration(seconds: 4),
onEnd: () {
print('iam here');
//Navigator.pushNamed(context, "/displayScreen");
},
),
),
);
}
}
onend function of animation container is a callback which should be called after animation completes. i have tried this on two projects but onend print is not printed. also checked with breakpoint that it never goes to onend function idk why.
Related
I'm new to Flutter and would love some help with an error.
While using the image_picker package, I noticed that I'm getting a value of null returned when I try to select an image from ios photo gallery.
(Specifically, [VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: [firebase_storage/object-not-found] No object exists at the desired reference.)
I read the package documentation where it says this is a known issue and to try it on a real device. I tried it on my real device an only got the desired result once. Can someone please shed some light on this? Below, I have provided the necessary code and a look and my flutter doctor. Thanks in advance!
P.S. To be clear, I am trying to test this on my physical ios device(iPhone 14 Pro Max), as I am aware of the issue with the ios Simulator and the image_picker package.
Please let me know if I need to provide more information to resolve this issue!
String? photoUrl = " ";
File? image;
Future pickImage() async {
try {
final image = await ImagePicker()
.pickImage(source: ImageSource.gallery, requestFullMetadata: false);
if (image == null) return;
Reference ref = FirebaseStorage.instance.ref().child("profilepic.jpg");
await ref.putFile(File(image.path));
await ref.getDownloadURL().then((value) {print(value); setState(() {
photoUrl = value;
});});
} on PlatformException catch (e) {
debugPrint('Failed to pick image: $e');
}
}
profilePic() {
final Size size = MediaQuery.of(context).size;
return SizedBox(
height: size.height * 0.185,
width: double.infinity,
child: Column(children: [
const Spacer(),
photoUrl != null
?
GestureDetector(
onTap: () {
pickImage();
},
child: Container(
height: 120,
width: 160,
decoration: const BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.all(
Radius.circular(20),
),
),
child: const Icon(
Icons.person,
size: 50,
color: Colors.white,
),
),
):Image.network(photoUrl!),
],
),
);
}
[✓] Flutter (Channel stable, 3.7.0, on macOS 12.6.1 21G217 darwin-arm64, locale en-US)
• Flutter version 3.7.0 on channel stable at /Users/myronsp/Developer/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision b06b8b2710 (9 days ago), 2023-01-23 16:55:55 -0800
• Engine revision b24591ed32
• Dart version 2.19.0
• DevTools version 2.20.1
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at /Users/myronsp/Library/Android/sdk
• Platform android-33, build-tools 33.0.0
• ANDROID_HOME = /Users/myronsp/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14C18
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2022.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
[✓] Connected device (5 available)
• sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 13 (API 33) (emulator)
• Myron’s iPhone (mobile) • 00008120-00016D500A80C01E • ios • iOS 16.0.2 20A380
• iPhone 14 Pro Max (mobile) • B8ACBFEA-35E5-4D2C-810C-46100D17EE63 • ios • com.apple.CoreSimulator.SimRuntime.iOS-16-2 (simulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 12.6.1 21G217 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 109.0.5414.119
hope you are included all the required steps for accessing gallery in android and iOS as mentioned here.
other chances are out dated packages in the flutter project.
please check the following link to rectify that link
If i am understanding correctly, below your spacer widget in your column children the condition should be photoUrl == null instead of photoUrl != null.
It would be good if you can share some findings.
In scrollable widget, when google map come to screen edges, its camera position slightly shifting. And it produces lagging
Is there an any way to prevent this behavior. Its like google_map trying to reposition its camera. I think this is like an undesired outcome. How could I keep stable the map while it is at screen edges
Sample code and flutter doctor outputs are below the example gif.
Code sample
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
class DenemePage extends StatelessWidget {
const DenemePage({Key? key}) : super(key: key);
#override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.only(top: 200, bottom: 1500),
child: Container(
width: MediaQuery.of(context).size.width,
height: 400,
child: Stack(
alignment: Alignment.center,
children: [
GoogleMap(
initialCameraPosition:
const CameraPosition(target: LatLng(40, 29), zoom: 10),
),
Icon(Icons.radar_outlined)
],
),
),
),
);
}
}
Flutter Doctor
[✓] Flutter (Channel stable, 2.10.3, on macOS 12.4 21F79 darwin-x64, locale tr-TR)
• Flutter version 2.10.3 at /Volumes/HARDDISK/SDKs/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 7e9793dee1 (5 months ago), 2022-03-02 11:23:12 -0600
• Engine revision bd539267b4
• Dart version 2.16.1
• DevTools version 2.9.2
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Volumes/HARDDISK/SDKs/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
[✓] VS Code (version 1.69.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.44.0
[✓] Connected device (2 available)
• iPhone 13 Pro (mobile) • BE0A3070-5A72-46F4-A649-6C7F17B9A731 • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-4 (simulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 103.0.5060.114
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
I have created a solution.
Download the google_maps_flutter
Edit the code in google_maps_flutter-2.1.8/iOS/Classes/GoogleMapController.m from
_mapView.delegate = weakSelf;
_registrar = registrar;
to
_mapView.delegate = weakSelf;
_mapView.paddingAdjustmentBehavior = kGMSMapViewPaddingAdjustmentBehaviorNever;
_registrar = registrar;
Put this modified google_maps_flutter-2.1.8 folder into somewhere. Let say parentFolder/google_maps_flutter-2.1.8.
In pubspec.yaml file which flutter project you want to use this modified package.
google_maps_flutter:
path: parentFolder/google_maps_flutter-2.1.8
Also I have opened a issue about that on GitHub. More detailed info is at there.
I'm trying introduction_screen 2.1.0 to show intro screen.
I imported it and declared import:
import 'package:introduction_screen/introduction_screen.dart';
But when I call IntroductionScreen(), an error occurred.
_AssertionError ('package:introduction_screen/src/introduction_screen.dart': Failed assertion: line 209 pos 16: '(showNextButton && next != null) || !showNextButton': is not true.)
I referenced some examples and wrote this simple code:
class Intro extends StatefulWidget {
const Intro({Key? key}) : super(key: key);
#override
_Intro createState() => _Intro();
}
class _Intro extends State<Intro> {
List<PageViewModel> getPages() {
return [
PageViewModel(
image: null,
title: "Live Demo page 1",
body: "Welcome to Proto Coders Point",
footer: Text("Footer Text here "),
decoration: const PageDecoration(
pageColor: Colors.blue,
)),
// .................
];
}
#override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Example"),
),
body: SafeArea(
child: IntroductionScreen( // ERROR!!
globalBackgroundColor: Colors.white,
pages: getPages(),
showNextButton: true,
showSkipButton: true,
skip: Text("Skip"),
done: Text("Got it "),
onDone: () {},
)));
}
}
As I said before, IntroductionScreen() is an issue.
I imported pub correctly, looks my environment is okay.
[√] Flutter (Channel beta, 2.6.0-5.2.pre, on Microsoft Windows [Version 10.0.22000.258], locale ja-JP)
• Flutter version 2.6.0-5.2.pre at D:\src\flutter_windows_2.5.0-stable\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 400608f101 (5 weeks ago), 2021-09-15 15:50:26 -0700
• Engine revision 1d521d89d8
• Dart version 2.15.0 (build 2.15.0-82.2.beta)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at D:\Android
• Platform android-30, build-tools 29.0.3
• Java binary at: D:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 4.2)
• Android Studio at D:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
[√] VS Code (version 1.61.2)
• VS Code at C:\Users\yukik\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.27.0
[√] Connected device (3 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 95.0.4638.54
• Edge (web) • edge • web-javascript • Microsoft Edge 95.0.1020.30
• No issues found!
From the documentation:
Define Next button (Widget), by adding next: Text('Next')
This param is required, except if you set showNextButton: false
in my case, which is version ^3.0.2 of introduction_screen package it is necessary to define "next" and "done" parameters in "IntroductionScreen" Class. These 2 properties are set to TRUE by Default:
IntroductionScreen(
pages: [
PageViewModel(
title: "Fractional shares",
body: "Instead of having to buy an entire share, invest any amount you want.",
),
PageViewModel(
title: "Learn as you go",
body: "Download the Stockpile app and master the market with our mini-lesson.",
),
],
onDone: () {
// When done button is press
},
showNextButton: true,
next: const Text("Next", style: TextStyle(fontWeight: FontWeight.w600)),
showBackButton: false,
done: const Text("Done", style: TextStyle(fontWeight: FontWeight.w600)),
),
I have a different behaviour when I run my app on Chrome then when I run it on iOS. It happens when I get to this screen:
import 'dart:io';
import 'package:fixit_shop_flutter/fixit_shop_app/authentication_bloc/user_repository.dart';
import 'package:fixit_shop_flutter/fixit_shop_app/register/bloc/register_bloc.dart';
import 'package:fixit_shop_flutter/fixit_shop_app/register/register_form.dart';
import 'package:fixit_shop_flutter/localization.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class RegisterScreen extends StatelessWidget {
final UserRepository _userRepository;
RegisterScreen({Key key, #required UserRepository userRepository})
: assert(userRepository != null),
_userRepository = userRepository,
super(key: key);
#override
Widget build(BuildContext context) {
dynamic backButton =
Platform.isIOS ? CupertinoIcons.back : Icons.arrow_back;
return Stack(
children: [
Image.asset('assets/mainBg.png',
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
fit: BoxFit.cover),
Scaffold(
backgroundColor: Colors.transparent,
appBar: AppBar(
centerTitle: true,
elevation: 0,
title: Text(
AppLocalizations.instance.text('RegisterScreenTitle'),
// textAlign: TextAlign.center,
style: TextStyle(
color: Colors.orange,
fontSize: 22,
fontWeight: FontWeight.w500,
letterSpacing: 1),
),
backgroundColor: Colors.transparent,
leading: IconButton(
icon: Icon(backButton),
color: Colors.redAccent,
onPressed: () {
Navigator.pop(context);
}),
),
body: BlocProvider<RegisterBloc>(
create: (context) => RegisterBloc(userRepository: _userRepository),
child: RegisterForm(),
),
),
],
);
}
}
If on iOS the screen loads normally, while when running the web version it throws the Another exception was thrown: Failed assertion: boolean expression must not be null error.
Do you now what could cause this different behaviour? I followed all the widgets that pass the userRepository along the tree and is all good..as in fact on iOS runs properly.
Here is my flutter doctor :
[✓] Flutter (Channel unknown, v1.12.13+hotfix.5, on Mac OS X 10.13.6 17G65, locale en-IT)
• Flutter version 1.12.13+hotfix.5 at /Users/vinnytwice/Developer/flutter
• Framework revision 27321ebbad (5 months ago), 2019-12-10 18:15:01 -0800
• Engine revision 2994f7e1e6
• Dart version 2.7.0
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/vinnytwice/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 10.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.2.1, Build version 10E1001
• CocoaPods version 1.8.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 44.0.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] Connected device (3 available)
• iPad Pro (10.5-inch) • 23C29147-A4F3-4B9F-8182-9C813D5A54AD • ios • com.apple.CoreSimulator.SimRuntime.iOS-12-2 (simulator)
• Chrome • chrome • web-javascript • Google Chrome 81.0.4044.129
• Web Server • web-server • web-javascript • Flutter Tools
• No issues found!
Do you see anything to update? I'm on High Sierra so I think I can't go above Flutter version 1.12.13+hotfix.5. Also I see that the channel is unknown..could it have something to do with it ?
As always many thanks for your time and help.
Cheers.
found the reason.. it wasn't the assertion but the platform check I was doing on backButton, that only included iOS..I added the check for the web and it now works es expected. I'll leave the question up as might help others porting their apps to web.
dynamic backButton;
if (kIsWeb) {
backButton = Icons.arrow_back;
} else if (Platform.isIOS) {
backButton = CupertinoIcons.back;
} else {
backButton = Icons.arrow_back;
}
I have a list of images just two of them in a Card Widget inside a ContrainedBox widget. I want to add more. When I click and load the page the application freezes.
Here is my Widget
#override
Widget build(BuildContext context) {
return DevScaffold(
title: "Team",
body: ListView.builder(
shrinkWrap: true,
itemCount: teams.length,
itemBuilder: (BuildContext context, int index) {
return Card(
elevation: 0.0,
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
ConstrainedBox(
constraints: BoxConstraints.expand(
height: MediaQuery.of(context).size.height * 0.2,
width: MediaQuery.of(context).size.width * 0.3,
),
child: CachedNetworkImage(
fit: BoxFit.cover,
imageUrl: teams[index].image,
),
),
SizedBox(
width: 20,
),...
Here is my data class:
List<Sponsor> sponsors = [
Sponsor(
name: "Google Developer Groups",
image: "https://devfestflorida.org/images/logos/gdg-logo-new.svg",
desc: "Platinum Sponsor",
url: 'https://developers.google.com/community/gdg/',
),
Sponsor(
name: "Neoware Studios",
image: "https://devfestflorida.org/images/logos/STUDIOSLOGO_WITHTM.png",
desc: "Platinum Sponsor",
url: 'https://www.neowarestudios.com/',
),
];...
There was no real exception thrown on the flutter side of things that made much sense, but here's the log:
C:\Users\javier.carrion\OneDrive\CodeVista\TechEvents\DevFest\DevFest2019Nov\devfestcenfl\devfestcenfl>flutter analyze
Analyzing devfestcenfl...
No issues found! (ran in 17.4s)
C:\Users\javier.carrion\OneDrive\CodeVista\TechEvents\DevFest\DevFest2019Nov\devfestcenfl\devfestcenfl>
C:\Users\javier.carrion\OneDrive\CodeVista\TechEvents\DevFest\DevFest2019Nov\devfestcenfl\devfestcenfl>
C:\Users\javier.carrion\OneDrive\CodeVista\TechEvents\DevFest\DevFest2019Nov\devfestcenfl\devfestcenfl>
C:\Users\javier.carrion\OneDrive\CodeVista\TechEvents\DevFest\DevFest2019Nov\devfestcenfl\devfestcenfl>
Flutter Doctor:
[√] Flutter (Channel stable, v1.9.1+hotfix.5, on Microsoft Windows [Version 10.0.16299.1087], locale en-US)
• Flutter version 1.9.1+hotfix.5 at C:\src\flutter
• Framework revision 1aedbb1835 (13 days ago), 2019-10-17 08:37:27 -0700
• Engine revision b863200c37
• Dart version 2.5.0
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at C:\Users\javier.carrion\AppData\Local\Android\Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
• All Android licenses accepted.
[√] Android Studio (version 3.4)
• Android Studio at C:\Program Files\Android\Android Studio1
• Flutter plugin version 35.3.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[√] VS Code, 64-bit edition (version 1.39.2)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.5.1
[√] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• No issues found!
As indicated in the comments CachedNetworkImage does not render svg. Flutter does not support SVG, however you can use a package that provides support like flutter_svg.
Here is a more information about svg support