smartherd / darttutorial Goto Github PK
View Code? Open in Web Editor NEWLearn Dart Programming, its basics and Fundamentals from scratch.
Learn Dart Programming, its basics and Fundamentals from scratch.
I found my interest in this repo so I just download it and open it into VSCode and found some error like
e.i. in 17_default_parameters has a function
int findVolume(int length, {int breadth = 2, int height = 20}) {
print("Lenght is $length");
print("Breadth is $breadth");
print("Height is $height");
print("Volume is ${length * breadth * height}");
}
this function doesn't return an integer value although the type is int.
Correct me If I did any mistake from my side.
Thank You
I just started with dart but it seems that this tutorial is outdated and the most recent dart version has
groundbreaking changes that break backwards compatibility.
this is from 21_getters_setters for example:
class Student {
String name; // Non-nullable instance field 'name' must be initialized.
double _percent; // Non-nullable instance field '_percent' must be initialized.
void set percentage(double marksSecured) => _percent = (marksSecured / 500) * 100;
double get percentage => _percent;
}
I copied the errors that dartpad.dev gave me, into the code above as comments.
both the name and _percent fields have to be initialized now. it's saying about non-nullable types,
I'm pretty sure I read somewhere that every type in dart is an object and therefore set to null when initialized without a value.
When I use String keyword to declared name without Initialize with value it's show me error, but when I used var instead of String it's work fine.
I have make a pdf on dart if you want i can attach and make a pull request if yes reply to me
thanks
Error in Fixed-Length List Declaration:
The fixed-length list is declared incorrectly, leading to a compilation error.
List numbersList = List(5); // This line causes an error
Error: The class 'List' doesn't have an unnamed constructor.
Proposed Fix: Replace it with List<int?> numbersList = List<int?>.filled(5, null);.
Error in For-Each Loop:
There's a type mismatch in the for-each loop due to the use of nullable integers.
for (int element in numbersList) { // This line causes a type mismatch error
print(element);
}
Proposed Fix: Change it to for (int? element in numbersList) {
Current Version of Dart SDK : 3.2.5 / 17 January 2024
Hello Sir! I am importing this project but getting errors I am just wanted to ask what is the solution for these errors one of them is not resolving pubspec.ymal file..........
Warning: You are using these overridden dependencies:
! flutter_web 0.0.0 from git https://github.com/flutter/flutter_web at c04fb5 in packages/flutter_web
! flutter_web_ui 0.0.0 from git https://github.com/flutter/flutter_web at c04fb5 in packages/flutter_web_ui
here is the code .i need help in switch case. I watched this video but I need more examples to completely understand switch case..
How can i use switch case to change bg color of listview .I want to add 10 different types of colors in listview
ListView.builder(
itemBuilder: (BuildContext context, int index) {
return Container(
color: (index % 10 == 0) ? Colors.red : Colors.green,
child: ListTile(
title: ...
),
);
},
)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.