Untitled

mail@pastecode.io avatar
unknown
dart
7 months ago
1.4 kB
1
Indexable
Never
import 'package:flutter/material.dart';
import 'package:weather/Worker/worker.dart';

class Loading extends StatefulWidget {
  const Loading({super.key});

  @override
  State<Loading> createState() => _LoadingState();
}

class _LoadingState extends State<Loading> {


  String? temperature;
  String? humid;
  String? wind_speed;
  String? describe;

   startApp() async{
     worker instance = worker(location: 'Dhaka');
     await instance.getData();

     temperature=instance.temp;
     humid=instance.humidity;
     wind_speed=instance.air_speed;
     describe= instance.describtion;

    //For checking before sending data in another screen(console a dekhen sob data ace kina)
    print("checking data.....> temperaute: $temperature...humidity : $humid...airspeed: $wind_speed...description: describe");

    Map<String, dynamic> map = {
           "temp_value":temperature,
           "humidity_value":humid,
           "air_speed_value":wind_speed,
           "describtion_value":describe
    
         };

     Navigator.pushReplacementNamed(context, '/home_page',arguments: map);


  }



  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    startApp();
  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(child: Text("Loading"))
    );
  }
}