Bienvenida e Introducci贸n

1

隆Renovaremos este curso!

2

Desarrollando en Flutter

3

驴Qu茅 es Flutter?

4

Dart y Flutter

5

Sintaxis de Dart

6

隆Renovaremos este curso!

7

Flutter para desarrolladores Android, iOS y Xamarin.forms

8

Flutter para desarrolladores React Native

9

驴C贸mo luce una app constru铆da en Flutter?

10

Primer reto

Creando mi entorno de desarrollo

11

隆Renovaremos este curso!

12

Requerimientos de Hardware y Software

13

Instalando Flutter en Android Studio y Visual Studio Code

14

Composici贸n de un proyecto en Flutter

Interfaces en Flutter

15

隆Renovaremos este curso! Te quedan unos d铆as para concluirlo.

16

Programaci贸n Declarativa en Flutter

17

Estructura de un programa en Flutter

18

Hola Mundo en Flutter

19

Widgets b谩sicos

20

Widgets con estado y sin estado

21

An谩lisis de Interfaces de Usuario en Flutter

22

Definiendo los layouts de nuestra interfaz

23

Segundo reto

Widgets sin estado en Flutter

24

隆Renovaremos este curso! Te quedan unos d铆as para concluirlo.

25

Flutter Widgets: Container, Text, Icon, Row

26

Flutter Widgets: Column

27

Recursos en Flutter: Tipograf铆as y Google Fonts

28

Widget Image

29

Widget Apilando Textos

30

Widgets Decorados

31

Widget Imagen Decorada

32

Widget Listview

33

Widget Button, InkWell

34

Tercer reto

Widgets con estado en Flutter

35

隆Renovaremos este curso! Te quedan unos d铆as para concluirlo.

36

Botones en Flutter

37

Clase StatefulWidget: C贸mo se compone

38

Widget Floating Action Button

39

Widgets BottomNavigationBar

40

Generando Navegaci贸n en BottomNavigationBar

41

Personalizando nuestro BottomNavigation Bar a Cupertino iOS BottomBar

42

Cuarto reto

Fin del Curso

43

隆Renovaremos este curso!

44

Conclusiones

45

隆Terminamos!

Aprende todo un fin de semana sin pagar una suscripci贸n 馃敟

Aprende todo un fin de semana sin pagar una suscripci贸n 馃敟

Reg铆strate

Comienza en:

4D
22H
16M
25S
Curso de Flutter

Curso de Flutter

Anah铆 Salgado D铆az de la Vega

Anah铆 Salgado D铆az de la Vega

Primer reto

10/45

Lectura

Utiliza DartPad (https://dartpad.dartlang.org/) para generar el siguiente reto:

...

Reg铆strate o inicia sesi贸n para leer el resto del contenido.

Aportes 1833

Preguntas 5

Ordenar por:

驴Quieres ver m谩s aportes, preguntas y respuestas de la comunidad?

o inicia sesi贸n.

Challenge completed!

import 'dart:math';

void main() {
	List<int> ages = [33, 15, 27, 40, 22];
  
  print("La edad mayor es: ${ages.reduce(max)}");
  print("La edad menor es: ${ages.reduce(min)}");
  print("La edad promedio es: ${ages.reduce((c, i) => c + i) / ages.length}");
}

馃巿 Este reto me sirvi贸 para poner en pr谩ctica lo que aprend铆 sobre Dart.

void main() {
  List<int> ages = [33, 15, 27, 40, 22];
  ages.sort();
  print('''
  Lista de Edades: ${ages}
  Edad Mayor: ${higher(ages)}
  Edad Menor: ${less(ages)}
  Edad Promedio: ${average(ages)}
  ''');
}

int higher(List<int> ages) {
  int age = ages[0];
  for (int index = 0; index < ages.length - 1; index++) {
    if (ages[index + 1] > age) {
      age = ages[index + 1];
    }
  }
  return age;
}

int less(List<int> ages) {
  int age = ages[0];
  for (int index = 0; index < ages.length - 1; index++) {
    if (ages[index + 1] < age) {
      age = ages[index + 1];
    }
  }
  return age;
}

double average(List<int> ages) {
  int sum = 0;
  for (int age in ages) {
    sum += age;
  }
  return sum / ages.length;
}

Qu茅 bonito es Dart, nunca hab铆a programado en 茅l y me pareci贸 asombroso. Aqu铆 dejo mi c贸digo:

Saludos!

void main() {
  var ages = [33,15,27,40,22];
  ages.sort();
  print('''
  La edad mayor es ${ages.last}'
  La edad menor es ${ages.first}'
  La edad promedio es ${ages.reduce((v,e)=>v+e)/ages.length}''');
 }```
void main() {
  List ages = [33, 15, 27, 40, 22];
  ages.sort();
  print('Menor: ${ages.first}');
  print('Mayor: ${ages.last}');
  print('Promedio: ${ages.reduce((value, element) => value + element)/ages.length}');
}

Reto Cumplido 馃槂

void main(){
  int edadMayor,edadMenor;
  var ages = [33, 15, 27, 40, 22];
  int i=0,s=0;
  edadMayor=ages[ages.length-1];
  edadMenor=ages[ages.length-1];
  while(i<ages.length){
    if(ages[i]>edadMayor){
      edadMayor=ages[i];
    }
    if(ages[i]<edadMenor){
      edadMenor=ages[i];
    }
    s=s+ages[i];
    i++;
  }
  print('La edad mayor es: $edadMayor \nLa edad menor es: $edadMenor \nLa edad promedio es: ${s/ages.length-1}');
}
void main() {
  var ages = [33, 15, 27, 40, 22];
  
  double avg = 0;
  for (int i = 0; i < ages.length; i++) {
    avg += ages[i] / ages.length;
  }
  
  ages.sort();
  print('Max is ${ages.last}');
  print('Min is ${ages.first}');
  print('Avg is $avg');
}```

Mi c贸digo qued贸 as铆:

void main() 
{
  var ages = [33, 15, 27, 40, 22];
  var mayor = ages[0];
  var menor = ages[0];
  var sumaNumeros = 0;
  var promedio;
  for (int i = 0; i < ages.length ; i++) 
  {
    if(ages[i] < menor)
    {
      menor = ages[i];
    }
     if(ages[i] > mayor)
    {
      mayor = ages[i];
    }
    sumaNumeros += ages[i];
  }
  promedio = sumaNumeros/ages.length;
  print("La edad mayor es: $mayor \n" +
        "La edad menor es: $menor \n" +
        "La edad promedio es: $promedio");
}
void main() {
  List <int> ages = [33,15,27,40,22]; 
  ages.sort();
  var dimen = ages.length; 
  var mean = ages.reduce((a,b) =>a + b)/dimen; 
  print('El valor menor es ${ages[0]}');
  print('El valor mayor es ${ages[dimen-1]}');
  print('El valor de la media es ${mean}');
  
}
void main() {
  var ages = [33,15,27,40,22];
  
 ages.sort();
  print(ages);
  print("La edad mayor es ${ages.last}");
  print("La edad menor es ${ages.first}");
  print("La edad promedio es ${ages.reduce((x, z) => x + z) / ages.length}");
}

// "La edad Menor es: 15"
// "La edad Promedio es: 27"
// "La edad Mayor es: 40"

void main() {
var ages = [33,15,27,40,22];

ages.sort();
print(ages);
print(鈥淟a edad mayor es ${ages.last}鈥);
print(鈥淟a edad menor es ${ages.first}鈥);
print(鈥淟a edad promedio es ${ages.reduce((x, z) => x + z) / ages.length}鈥);
}

Usando un poco ayudas en Dart XD

import 'dart:math';
void main() {
  var ages = [33,15,17,40,22];
  print('La edad mayor es: ${ages.reduce(max)}');
  print('La edad mayor es: ${ages.reduce(min)}');
}
void main() {
  var ages = [33, 15, 27, 40, 22];
  ages.sort();
  
  var average = ages.reduce((value, element) => value + element) / ages.length;
  
  print("The oldest age is: ${ages.last}");
  print("The youngest age is: ${ages.first}");
  print("The average age is: ${average}");  
}

Codigo

void main() {
  var ages = [33, 15, 27, 40, 22];
  dynamic less = ages[0];
  dynamic more = ages[0];
  dynamic sum = 0;
  for(int i = 0; i< ages.length; i++){
    less = (ages[i] < less)? ages[i] : less;
    more = (ages[i] > more)? ages[i] : more;
    sum += ages[i];
  }
  dynamic prom = sum/ages.length;
  print('La edad mayor es: $more');
  print('La edad menor es: $less');
  print('La edad promedio es: $prom');
}

Consola

La edad mayor es: 40
La edad menor es: 15
La edad promedio es: 27.4
void main() {
  
  var ages = [33, 15, 27, 40, 22];
  	ages.sort();
  print(ages);
 
  print('La edad mayor es: ${ages.last}');
  print('La edad menor es: ${ages.first}');
   var sum = 0;
  for (var num in ages) {
    sum = sum + num;
  }
  var promedio = sum/ages.length;
   print('El promedio es: $promedio');
}

As铆 lo resolvi yo.

void main() {
  var ages = [33, 15, 27, 40, 22];
  ages.sort();
  
  var min = ages[0];
  var max = ages[ages.length - 1];
  dynamic avg = 0;
  
  ages.forEach((age) {
    avg += age;
  });
  avg = avg / ages.length;
  
  
  print('Edad M铆nina: ${min}');
  print('Edad M谩xima: ${max}');
  print('Edad Promedio: ${avg}');
}


//Edad M铆nina: 15
//Edad M谩xima: 40
//Edad Promedio: 27.4
void main() {
  var ages = [33,15,27,40,22];
  ages.sort();
  var suma = 0;
  for (var i=0; i<ages.length; i++){
    suma = suma + ages[i];
  }
  var promedio = (suma/ages.length);
  
  print('''El arreglo ordenado es: ${ages}
  La edad mayor es ${ages[ages.length-1]}
  La edad menor es ${ages[0]}
  La edad promedio es ${promedio}
         ''');
}

Mi soluci贸n:

var ages = [33, 15, 27, 40, 22];

void main(){
  //Order ages
  ages.sort();
  print('La edad mayor es: ${ages.last}');
  print('La edad menor es: ${ages.first}');
  
  //Average calculation
  int total = 0;
  double average = 0;
  ages.forEach((item) {
    total = total + item;
  });
  
  average = total/ages.length;
  print('La edad promedio es: ${average}');

}
void main() {
/*Declaraci贸n de variables*/  
  var edades = [33,15,27,40,22];
	var edadMayor = 0;
  var edadMenor = 0;
  var cuentoEdades = 0;
  dynamic edadPromedio = 0;
/*Inicio del primer for para comparar edades mayores*/  
  for(int i = 0; i<=4; i++){
    if(edades[i] > edadMayor) {
    	 edadMayor = edades[i];
    }else{
      edadMenor = edades[i];
      /*Comparo edades Menores*/
      for(int i = 1; i<=4; i++){
        if(edades[i] < edadMenor){
          edadMenor = edades[i];
        } 
       }
     } 
    cuentoEdades += edades[i];
   }
	edadPromedio = cuentoEdades/5;
   print("La edad mayor es: $edadMayor");
  print("\n La edad menor es:  $edadMenor");
  print("\n La edad promedio es:  $edadPromedio");
}



Esta es mi soluci贸n鈥 馃槂

void main() {
  
  var ages = [33, 15, 27, 40, 22];
  var sum = 0;

  ages.sort(); //ordenar la lista
  ages.forEach((age) => sum += age); //recorre la lista y suma las edades 

  print('La edad menor es ${ages[0]}');
  print('La edad mayor es ${ages[ages.length - 1]}');
  print('La edad promedio es ${sum/ages.length}');

}
void main() {
  var ages = [33,15,27,40,22];
  double promedio = 0;
  
  ages.sort();
  ages.forEach((edad) => {promedio = promedio + edad});
  
  print("La edad mayor es ${ages[ages.length-1]}");
  print("La edad menor es ${ages[0]}");
  print("La edad promedio es ${promedio/ages.length}");

}```
  void main() {
  var ages = [33,15,27,40,22];
   //ordenar  menor a mayor
  ages.sort();
   
  int suma = 0;
   //calcular suma del vector edades
  ages.forEach((x) { suma += x; });
  
  print("La edad Mayor es ${ages[ages.length - 1]}");
  print("La edad Menor es ${ages[0]}");
   //Calcular Promedio
  print("La edad promedio es ${suma/ages.length}");
}
  

Recuerden que siempre puede que alguien ya tenga una funcion para ello, solo hace falta importar la libreria =D

import 'dart:math';
void main() {
  
  var ages=[33,15,27,40,22];
  
  int maxAge = ages.reduce(max), 
      minAge = ages.reduce(min);
  
  print('max: $maxAge' "\n" "min: $minAge");
  
 }

Hola!, aqu铆 est谩 mi c贸digo:

void main() {
  var ages = [33, 15, 27, 40, 22];

  ages.sort(); // Organizamos la lista
  var sum = 0;
  
  print('Min age is: ${ages[0]}');
  print('Max age is: ${ages[ages.length - 1]}');
  ages.forEach((it) => {
    sum += it
  });
                       
  print('Avg age is: ${sum / ages.length}');
  
}```
main() {
  var ages = [33, 15, 27, 40, 22];
  ages.sort();
  var prom =  ages.reduce((current, next) => current + next);
  print('La edad mayor es: ${ages.last}');
  print('La edad menor es: ${ages.first}');
  print('La edad promedio es: ${prom/ ages.length}');
} 

void main() {
  var ages = [33, 15, 27, 40, 22];
  ages.sort();
  int menor = ages.first;
  int mayor = ages.last;
  double prom = 0;
  
  var sum = ages.reduce((a, b) => a + b);
  var promedio = sum / ages.length;
  
  print("La edad mayor es: $mayor");
  print("La edad menor es: $menor");
  print("El promedio es: $promedio");
}
void main() {
  List<int> ages = [33,15,27,40,22];
  ages.sort();
  print('La edad menor es: ${ages.first}');
  print('La edad mayor es: ${ages.last}');
  print('La edad promedio es: ${ages.reduce((a,b) => a+b)/ages.length}');
}

void main() {
  var ages = [33, 15, 27, 40, 22];
  ages.sort();
  print('El menor tiene ${ages.first} a帽os');
  print('El mayor tiene ${ages.last} a帽os');
  print('La edad promedio es ${(ages.reduce((value, element) => value + element))/ages.length}');  
}```
void main() {
  var ages=[33, 15, 27, 40, 22];
  ages.sort();
  print('la edad menor es: ${ages[0]}');
  print('la edad mayor es: ${ages[ages.length-1]}');
  var sum = ages.reduce((a,b)=>a+b);
  print('la edad promedio es: ${sum/ages.length}');
}

Les adjunto mi reto

void main() {
  List<int> list = [33, 15, 27, 40, 22];
  int suma = 0;
  list.sort();
  list.forEach((element) => suma += element);
  double prom = suma / (list.length);
  print('La edad mayor es: ${list[list.length - 1]}');
  print('La edad menor es: ${list[0]}');
  print('La edad promedio es: $prom ');
}
void main() {
  var ages = [33, 15, 27, 40, 22];
  ages.sort();
 
  int average = 0;
  ages.forEach((val) => average += val);
  average = average ~/ ages.length;
  
  print("El menor es ${ages.first}");
  print("El mayor es ${ages.last}");
  print("El promedio es $average");
}

void main() {
  var ages = [33, 15, 27, 40, 22];
  var mean = 
  
  ages.sort();
  
  var avg = ages.reduce((a,b)=> a+b) / ages.length;
  
  print("La edad menor es: "+ ages[0].toString());
  print("La edad mayor es: "+ ages[ages.length-1].toString());
  print("El promedio de edad es :"+ avg.toString());
  
}

Esto pasa cuando no conoces el m茅todo sort >> jajaja

void main() {
  
  var ages = [33, 15, 27, 40, 22];
  int max = 0;
  int min = 0;
  int sum = 0;
  double pro = 0;
  
  min = ages[0];
  
  for (int i=0; i < ages.length; i++) {
    
    sum += ages[i];
  
    if (ages[i] > max) {
      max = ages[i];
    }
    
    if (ages[i] < min) {
      min = ages[i];
    }
  
  }
  
  pro = sum / ages.length;
  
  print('La edad mayor es ${max}');
  print('La edad menor es ${min}');
  print('La edad promedio es ${pro}');

}```

Muy divertido 馃槂

import 鈥榙art:math鈥;
void main() {

var edad = [33, 15, 27, 40, 22];
var mayor = edad.reduce(max);
var menor = edad.reduce(min);
var sum = edad.fold(0, (t,e) => t + e);
var media = sum / edad.length;

print(鈥楲a mayor de edad es: $mayor鈥);
print(鈥楲a menor de edad es: $menor鈥);
print(鈥楲a suma de edad es: $sum鈥);
print(鈥楲a media de edad es: $media鈥);

}

void main() 
{
  var edades = [33, 15, 27, 40, 22];
  var edadMayor = edades[0];
  var edadMenor = edades[0];
  var sumaEdades = 0;
  var promedio;
  
  for (int i = 0; i < edades.length ; i++) 
  {
    if(edades[i] < edadMenor){
      edadMenor = edades[i];
    }
    
    if(edades[i] > edadMayor){
      edadMayor = edades[i];
    }
    
    sumaEdades += edades[i];
  }
  
  promedio = sumaEdades/edades.length;
  
  print("La edad mayor es: $edadMayor \n" +
        "La edad menor es: $edadMenor \n" +
        "La edad promedio es: $promedio");
}
void main() {
  var max=0,min=999999999;
  var ages= [33, 15, 27, 40, 22];
  
  for (int i = 0; i < 5; i++) {
    if(ages[i]>max){
      max=ages[i];
    }
    
     if(ages[i]<min){
      min=ages[i];
    }
    
  }
  
  print(max);
  print(min);
}

import 鈥榙art:math鈥;

void main() {
var edades = [33, 15, 27, 40, 22];
var edadMayor = edades.reduce(max);
var edadMenor = edades.reduce(min);

print (鈥淟a edad mayor es: $edadMayor鈥);
print (鈥淟a edad menor es: $edadMenor鈥);

double edadPromedio = 0;
for (int i=0; i<edades.length - 1; i++){
edadPromedio = edadPromedio + edades[i];
}
edadPromedio = edadPromedio / edades.length;
print (鈥淟a edad promedio es $edadPromedio鈥);
}

void main() {
var ages = [33, 15, 27, 40, 22];
int menor=ages[0],mayor=ages[0];
int suma = 0;
for (int i = 0; i < ages.length; i++) {
if(ages[i]<menor){
menor=ages[i];
}else if(ages[i]>mayor){
mayor=ages[i];
}
suma+=ages[i];//33+15+27+40+22
}
print(鈥楨l menor es $menor鈥);
print(鈥楨l mayor es $mayor鈥);
print(鈥楨l promedio es ${suma/ages.length}鈥);
}
Pandas: Carolina, Gimena, Sebasti谩n, Carlos

void main() {
 List ages = [33, 15, 27, 40, 22];
  ages.sort();
  print(""" La edad mayor es: ${ages[ages.length-1]}
        La edad menor es: ${ages[0]}
        La edad promedio es: ${ages.reduce((current,next)=>current+next)/ages.length}        
  """
  );
  
}

void main () {
  List<int> ages = [33, 15, 27, 40, 22];
  ages.sort();
  
  double average = ages.reduce((a,b) => a+b) / ages.length;
  
  print("La edad mayor es: ${ages[ages.length - 1]}");
  print("La edad menor es: ${ages[0]}");
  print("La edad promedio es: ${average.round()}");
  
}

Mi aporte:

<void main() {
  List <int> numeros = [33, 15, 27, 40, 22];
  numeros.sort();
  print("La edad menor es: ${numeros.first}");
  print("La edad mayor es: ${numeros.last}");
  var sum = numeros.reduce((curr, next) => curr + next);
  var prom = sum/numeros.length;
  print("La edad promedio es: $prom");
}> 

Reto completado

var ages = [33, 15, 27, 40, 22];
  ages.sort();
  print("El valor mayor es: ${ages.last}");
  print("El valor menor es: ${ages.first}");
  print("El promedio es: ${ages.reduce((val1, val2) => (val1 + val2)) / ages.length }");

Hola a todos, este es mi aporte:

void main() {
  var ages = [33, 15, 27, 40, 22];
  ages.sort();
  
  double sum = 0, prom =0;
  for (int i = 0; i < 5; i++) {
      sum = sum + ages[i];
  }
  prom = sum/ages.length;
  
  print("La edad mayor es: ${ages.last}");
  print("La edad menor es: ${ages.first}");
  print("La edad promedio es:: ${prom}");
}

mi soluci贸n:

import 'dart:math';

void main() {
  
  var ages = [33, 15, 27, 40, 22];
  ages.sort();
  print('Edad mayor ${ages.reduce(max)}');
  print('Edad menor ${ages.reduce(min)}');
  print('Edad promedio ${ages.reduce((a, b) => a + b) / ages.length}');
  
}

Me siento genial escribiendo codigo en mi 4 lenguaje de programaci贸n

void main() {
  //declarar variables
  List<int> list =[33, 15, 27, 40, 22];
  double prom = 0;
  
  //calculos
  list.sort();
  list.forEach((int num) => prom += num);
  prom /= list.length;
  
  
  //results
  print('La edad mayor es: ${list[list.length - 1]} , La edad menor es:${list[0]} , La edad promedio es:${prom} ');
}

var ages = [33, 15, 27, 40, 22];
var total = ages.reduce((a,b) => a+b);
var average = total / ages.length - 1;

void main() {
  ages.sort((a, b) => a.compareTo(b));
  print('La edad mayor: ${ages[ages.length-1]}');
  print('La edad menor: ${ages[0]}');
  print('La edad promedio: ${average}');
}
void main() {
  var ages = [33, 15, 27, 40, 22];
  
  var higher = null;
  var less = null;
  var averague = 0;
  ages.forEach((age) {
    averague += age;
    
    if (higher == null || higher < age) {
      higher = age;
    }
    
    if (less == null || less > age) {
      less = age;
    }
  });
  
  print('La edad mayor es: ${higher}');
  print('La edad menor es: ${less}');
  print('La edad promedio es: ${averague / ages.length}');
}
int max(int a,int b)
{
   if(a>b)
     return a;
   else 
     return b;
}

int min(int a,int b)
{
   if(a<b)
     return a;
   else 
     return b;
}


void main() {
  var ages = [33, 15, 27, 40, 22];
  int maximo = 0, minimo= 300;
  double promedio = 0;
  for (int i = 0; i < 5; i++) {
      maximo = max(maximo,ages[i]);  
      minimo = min(minimo,ages[i]);
      promedio += ages[i];
  }
   print('maximo:  ${maximo}');
   print('minimo:  ${minimo}');
   print('promedio:  ${promedio/ages.length}');
}


void main() {
  var ages = [33, 15, 27, 40, 22];
  ages.sort();

  print(
      "La edad Mayor es: ${ages[0]}, la edad menor es: ${ages[ages.length - 1]}, y el promedio es: ${ages.reduce((a, b) => a + b) / ages.length}");
}
void main() {
  var ages = [33, 15, 27, 40, 22];
  ages.sort();
  print(ages);
  
  var sum = ages.reduce((currentNumber, nextNumber)=>currentNumber + nextNumber);
  print('La edad Minima es: ${ages[0]}');
  print('La edad maxima es: ${ages[ages.length - 1]}');
  print('La edad promedio es: ${sum / ages.length}');
}

void main() {
  var lista = [33, 15, 27, 40, 22];
  var edadMayor = 0;
  var edadMenor = lista[0];
  var edades = 0;  
  
  for (int i = 0; i < lista.length; i++) {
    if (edadMayor < lista[i])
      edadMayor = lista[i];
    
    if (edadMenor > lista[i])
      edadMenor = lista[i];
   
    edades += lista[i];    
  }
  
  print('La edad mayor es: ${edadMayor}');
  print('La edad menor es: ${edadMenor}');
  print('La edad promedio es: ${edades / lista.length}');
}

Reto conseguido, aunque se agradecerian recomendaciones para mejorarlo

void main() {
  var ages = [33, 15, 27, 40, 22];
      ages.sort();
  
  print('La edad menor es ${ages.first}');
  print('La edad promedio es ${137 / ages.length}');
  print('La edad mayor es ${ages.last}');
  }
void main() {
  var ages = [33, 15, 27, 40, 22];

  ages.sort();
  print('La edad mayor es: ${ages.last}');
  print('La edad menor es: ${ages.first}');
  print('La edad promedio es: ${ages.reduce((a, b) => a + b) / ages.length}');
}
void main() {

  List<int> ages = [22,15,27,40,22];
  ages.sort();
  double avg = ages.reduce((a,b)=> a+b)/ ages.length;
  print('La edad mayor es: ${ages.reversed.first}');
  print('La edad menor es: ${ages.reversed.last}');
  print('El promedio es: $avg');
  
}

void main() {
var ages=[33,15,27,40,22];
var total = 0;
List<int> nums = ages.toList();
nums.sort();
nums.forEach((x) => total += x);
print(鈥淟a edad promedio es: ${total/nums.length}鈥);
print(鈥淟a edad menor es: ${nums.first}鈥);
print(鈥淟a edad mayor es: ${nums.last}鈥);
}

import 'dart:math';

void main() {
  var ages = [33, 15, 27 , 40, 22];
  print("La edad mayor es: ${ages.reduce(max)}");
  print("La edad menor es: ${ages.reduce(min)}");
  print("La edad promedio es: ${ages.reduce((a,b) => a + b) / ages.length}");
}
var ages = [33, 15, 27, 40, 22];
  ages.sort();
  var average = ages.reduce((value, element) => value + element) / ages.length;
  print("The higher age is: ${ages.last}");
  print("The lower age is: ${ages.first}");
  print("The average age is: $average");

He tenido que buscar info porque estoy empezando pero ha sido satisfactorio.

void main() {
  var ages = [33, 15, 27, 40, 22];
  ages.sort();
  double average = 0;
 
  for(int i=0; i < ages.length; i++){
    average += ages[i];  
  }
  
  print("""
  La edad mayor es: ${ages.last}
  La edad menos es: ${ages.first}
  La edad promedio es: ${average / ages.length}
  """); 
}```

Mi solucion con lo poco que recuerdo de C++

void main() {
  var ages = [33, 15, 27, 40, 20];
  var mayor = ages[0];
  var menor = mayor;
  double promedio = 0;
  
  
  for (int i = 0; i < ages.length; i++) {
    promedio += ages[i];
    if( ages[i] > mayor){
      mayor = ages[i];
    }
    if(ages[i] < menor){
      menor = ages[i];
    }
  }
  promedio = promedio / (ages.length +1);
  print("Edad menor: ${menor}");
  print("Edad mayor: ${mayor}");
  print("Edad menor: ${promedio}");
}

import 'dart:math';
void main() {
  List<int> ages =[33, 15, 23, 2];
  int maxval = ages.reduce(max);
  int minval = ages.reduce(min);
  
  
  print('La mayor edad es: $maxval');
  print('La menor edad es: $minval');
  print("La edad promedio es: ${(ages.reduce((a, b) => a +b))/ages.length}");
   

}```

Bastante simple y me siento c贸modo como desarrollador de Python y Java.

import 'dart:math';

void main() {
  var ages = [33, 15, 27, 40, 22];
  
  int maxValue = ages.reduce(max);
  int minValue = ages.reduce(min);
  double avg = ages.reduce((val, elem) => val + elem) / ages.length;
  
  print("Max age is: $maxValue");
  print("Min age is: $minValue");
  print("Average age is: $avg");
}
void main() {
  var ages = [33, 15, 27, 40, 22];
  ages.sort();
  print("La edad mayor es: ${ages.last}");
  print("La edad menor es: ${ages.first}");
  print("La edad promedio es: ${(ages.reduce((a, b) => a + b))/ages.length}");
}

void main() {
var ages = [33, 15, 10, 35, 5, 75];
int mayor = 0;
int menor = ages[0];
double average = 0;
for (int i = 0; ages.length > i; i++) {
if (mayor < ages[i]) {
mayor = ages[i];
}
if (menor > ages[i]){
menor = ages[i];
}
average = average + ages[i];
}
average = average/ages.length;
print (鈥淓l valor menor es: $menor鈥);
print (鈥淓l valor mayor es: $mayor鈥);
print (鈥淓l promedio es: $average鈥);

}

void main() {
  //Declaro e inicializo una lista o arreglo 
 var ages = [33, 15, 27, 40, 22];
  // Ordeno los elementos del arreglo utilizando la funci贸n sort()
 ages.sort();
 print('Edades ordenadas: $ages');
  //Obtengo e mprimo la edad mayor
 var older = ages[4];
 print('La edad mayor es: $older');
  //Obtengo e imprimo la edad menor
 var younger = ages[0];
 print('La edad menor es: $younger'); 
  //Realizo la sumatoria de edades utilizando la Funci贸n reduce()
 var agesSum = ages.reduce((a,b) => a + b);
 //Declaro una variabe y calculo el promedio de edades
 double prom = agesSum/ages.length;
 //Imprimo el promedio 
 print('El promedio de edades es: $prom');
}

void main() {  
  var ages = [33, 15, 27, 40, 22];
  int edadMenor = 100, edadMayor = 0;
  double edadPromedio = 0;
  for (var age in ages){
    if(age < edadMenor)
      edadMenor = age;
    if(age > edadMayor)
      edadMayor = age;
    edadPromedio += age;
  }
  edadPromedio /= ages.length;
  print("La edad mayor es: ${edadMayor}");
  print("La edad menor es: ${edadMenor}");
  print("La edad promedio es: ${edadPromedio}");
}
void main() {
  var ages = [33, 15, 27, 40, 22];
  ages.sort();
  var menor = ages.first;
  var mayor = ages.last;
  var suma = 0;
  for (int i = 0; i < (ages.length); i++) {
    suma = suma + ages[i];
  }
  print('Edades en orden ${ages}, el menor es ${menor}, el mayor es ${mayor} y el promedio de edades es ${suma/(ages.length) }');
}
void main() {
  final ages = [33, 15, 27, 40, 22];
  ages.sort();
  
  int smallest = ages.first;
  int largest = ages.last;
  
  double average = ages.reduce((x, y) => x + y) / ages.length;
  
  print('La edad mayor es: ${largest}');
  print('La edad menor es: ${smallest}');
  print('La edad promedio es: ${average}');
}

void main() {
	List<int> ages = [33, 15, 27, 40, 22];

	ages.sort();

	print("La edad menor es: ${ages[0]}");
	print("La edad mayor es: ${ages.last}");
	print("La edad promedio es: ${ages.fold(0, (acc, val) => acc + val) / ages.length}");
}

Mi soluci贸n al reto. Use el m茅todo sort para organizar la lista de menor a mayor, las propiedades first y last para obtener la edad menor y la edad mayor y para sacar el promedio use el m茅todo reduce que la guarde en una variable double llamada prom.

void main() {
  var ages = [33,15,27,40,22];
  ages.sort();
  double prom = ages.reduce((value, element) => (value + element)) / ages.length;
  print('La edad menor es: ${ages.first}');
  print('La edad Mayor es: ${ages.last}');
  print('La edad promedio es: ${prom}');  
}
import 'dart:math';

void main() {
  var ages = [33, 15, 27, 40, 22];
  var sum = ages.reduce((acc, current) => acc + current);
  
  print('La edad mayor es: ${ages.reduce(max)}');
  print('La edad menor es: ${ages.reduce(min)}');
  print('La edad promedio es: ${sum / ages.length}');
}
void main() {
  var ages = [33, 15, 27, 40, 22];
  ages.sort();
  var sumTotal = ages.reduce((a, b) => a + b);

  print("The greater age:${ages[ages.length-1]}");
  print("The minor age:${ages[0]}");
  print("The average is: ${sumTotal/ages.length}");
}

void main() {
var ages = [33, 15, 27, 40, 22];

int calcularMayor(ages) {
var max = ages[0];
for (var age in ages) {
if (age >= max) {
max = age;
}
}
return max;
}

int calcularMenor(ages) {
var min = ages[0];
for (var age in ages) {
if (age <= min) {
min = age;
}
}
return min;
}

double averageAge(ages) {
var sum = 0;
for (var age in ages) {
sum = sum + age;
}
var avg = sum / ages.length;
return avg;
}

var mayor = calcularMayor(ages);
var menor = calcularMenor(ages);
var prom = averageAge(ages);

print(鈥楲a edad mayor es $mayor鈥);
print(鈥楲a edad menor es $menor鈥);
print(鈥楨l promedio de edad es $prom鈥);
}

void main() {

List<int> listAge=[33, 15, 27, 40, 22];
print("La edad mayor es: "+edadMayor(listAge).toString());
print("La edad menor es: "+edadMenor(listAge).toString());
print("La edad promedio es: "+edadPromedio(listAge).toString());

}

int edadMayor(List<int> listAge){

int mayor=listAge[0];

for (int i = 1; i < listAge.length; i++) {
int actual = listAge[i];
if(mayor<actual){
mayor=actual;
}
}

return mayor;
}

int edadMenor(List<int> listAge){

int menor=listAge[0];

for (int i = 1; i < listAge.length; i++) {
int actual = listAge[i];
if(menor>actual){
menor=actual;
}
}

return menor;
}

double edadPromedio(List<int> listAge){

int sumEges=0;

for (int i = 0; i < listAge.length; i++) {
sumEges+=listAge[i];
}
double prom = sumEges/listAge.length;

return prom;
}

void main() {
  var ages = [33, 15, 27, 40, 22];
  int less = ages[0];
  int higher = ages[0];
  int size = ages.length;
  int sum = 0;
  double average = 0.0;

  for (var i = 0; i < ages.length; i++) {
    if (higher < ages[i]) {
      higher = ages[i];
    }

    if (less > ages[i]) {
      less = ages[i];
    }

    sum = sum + ages[i];
  }
  average = f_average(sum, size);
  print('La edad mayor es: ${higher}');
  print('La edad menor es: ${less}');
  print('La edad promedio es: ${average}');
}

f_average(sum, size) {
  return sum / size;
}
<code>
import'dart:math';

main() {
  var ages = [33, 15, 27, 40, 22];
  var sumar = ages.reduce((a, b) => a + b);
  print('La edad mayor es: ${ages.reduce(max)}');
  print('La edad menor es: ${ages.reduce(min)}');
  print('La edad promedio es: ${sumar/ages.length}');
}
</code>

Consola:
La edad mayor es: 40
La edad menor es: 15
La edad promedio es: 27.4
void main() {
  var ages = [33, 15, 27, 40, 22];
  int mayor=ages[0];
  int menor= ages[0];
  int prom=ages[0];
  
  for(int i=1;i<ages.length;i++){
    
        if (mayor<ages[i]){
          mayor=ages[i];
        }
    
        if (menor>ages[i]){
          menor=ages[i];
        }
    
    prom+=ages[i];
          
  }
  
  print('El valor mayor es: ${mayor}');
  print('El valor menor es: ${menor}');
  print('El promedio es: ${prom/ages.length}');
  
}

void main() {
var ages = [33, 15, 27, 40, 22];
print(鈥淟a edad mayor es ${ages.reduce((a,b) => a>b ? a : b)}鈥);
print(鈥淟a edad menor es ${ages.reduce((a,b) => a<b ? a : b)}鈥);
print(鈥淟a edad promedio es ${(ages.reduce((a,b) => a+b)/ages.length).round()}鈥);
}

Ah铆, humildemente 鉂わ笍

  List<int> arr = <int>[33, 15, 27, 40, 22];
  arr.sort();
  
  int count = 0;
  for(int i=0; i< arr.length; i++){
    count += arr[i];
  }
  
  var menor = arr[0];
  var mayor = arr[arr.length - 1];
  var promedio = count/arr.length;
  
  print("La edad menor es: $menor");
  print("La edad mayor es: $mayor");
  print("La edad promedio es: $promedio");

void main() {
var ages = [33, 15, 27, 40 ,22];
var sum = 0;
ages.sort();
var prom = ages.reduce((a,b) => a+b) / ages.length;
print ([鈥楲a edad mayor es: ${ages.last}鈥,鈥楲a edad menor es: ${ages.first}鈥,鈥楲a edad promedio es: $prom鈥橾);
}

void main() {
  var ages = [33, 15, 27, 40, 22];
  var count = 0;
  var agesLength = ages.length;
  ages.sort();
  /* Una forma de sumar todos los valores del array*/
  for (int i = 0; i < agesLength; i++) {
    count += ages[i];
  }
    print('La edad menor es ${ages.first}');
    print('La edad mayor es ${ages.last}');
    print('El promedio es ${count/agesLength}');
  /* Otra forma de sumar todos los valores del array usando la funcion reduce*/
  print('promedio ${ages.reduce((a,b)=> a+b)/agesLength}');
}```
var ages =[33,15,27,40,22]; 

String printAges(String typeAge, int ageToPrint){
  return "La edad ${typeAge} es: ${ageToPrint}";
}

void main() {
  ages.sort();
  var resLast = printAges("mayor",ages.last);
  var resFirst = printAges("menor",ages.first);
  var plusAges = ages.reduce((a,b)=>a+b);
  var averageAges = plusAges/ages.length;
  var resAverage = printAges("promedio",averageAges.toInt());
  print("${resLast}");
  print("${resFirst}");
  print("${resAverage}");
}

void main() {
  var ages = [33, 15, 27, 40, 22];
  int total = 0;
  ages.sort();
  for (int i = 0; i < ages.length; i++) {
    total = total  + ages[i];
  }
  
  print("La edad menor es: ${ages[0]}");
  print("La edad menor es: ${ages.last}");
  print("la edad promedio es: ${total/ages.length}");
}
void main() {
  var ages = [33, 15, 27, 40, 22];
  var minAge = ages[0];
  var maxAge = ages[0];
  double averageAge = 0;
  for (int i = 0; i < ages.length; i++) {
    averageAge = averageAge + ages[i];
    if (ages[i]<minAge)
      minAge = ages[i];
    if (ages[i]>maxAge)
      maxAge = ages[i];
  }
  averageAge = averageAge / ages.length;
  print('La edad mayor es: ${maxAge}');
  print('La edad menor es: ${minAge}');
  print('La edad promedio es: ${averageAge}');

}
void main() {
  List<int> ages = [15, 16, 17, 20, 32, 31, 42, 42, 23, 31, 27, 48];
  Ages proc = new Ages(ages);
  
  print("La edad mayor es: ${proc.getMayor()}");
  print("La edad menor es: ${proc.getMenor()}");
  print("La edad promedio es: ${proc.getPromedio()}");
}

class Ages {
  List<int> ages = [];
  
  Ages(List<int> ages) {
    this.ages = ages;
  }
  
  int getMayor() {
    return this.ages.last;
  }
  
  int getMenor() {
    return this.ages.first;
  }
  
  int getPromedio() {
    int total = 0;
    this.ages.forEach((age) => total+=age);
    return (total/this.ages.length).round();
  }
}

Con tres lineas se logro woow, me gusto el c贸digo


1.

Espero que me haya quedado bien, hoy fue la primera vez que programo en Dart 馃槃

void main() {

var ages = [33, 15, 27, 40, 22];
  
  var oldest=0;
  var youngest=ages[0];
  var average=0;

for( int a in ages){
  if(a>oldest){
    oldest =a;
  }
  else if(a<youngest){
   youngest = a;
  }
  average+=a;
}
  
  print('Oldest= $oldest');
  print('Youngest= $youngest');
  print('Average= ${average/ages.length}');

Listo 馃槃

void main(){
  
  var ages = [33, 15, 27, 40, 22];
  var numEdades = ages.length;
  ages.sort();
  var edadMenor = ages[0]; 
  var edadMayor = ages[numEdades-1];
  var sumaEdad = 0;
  for(var i=0; i < numEdades; i++){
    sumaEdad = sumaEdad + ages[i];
  }
  var edadPromedio = sumaEdad / numEdades;
  print("La edad menor es $edadMenor, la edad mayor es $edadMayor y la edad promedio es $edadPromedio");
  
}

Hola, comparto mi codigo

void main() {
  var ages = [33, 15, 27, 40, 22];
  var max = 0;
  var min = 10000000;
  var sum = 0;
  var cant = ages.length;
  var prom = 0.0;
  ages.forEach((item){
    if(item > max){
      max = item;
    }
    else if(item < min){
      min = item;
    }
    sum = sum + item;
  });
  prom = sum / cant;
  print('La edad maxima es $max');
  print('La edad minima es $min');
  print('El promedio es $prom');
}