Advertisement
namo352

api_provider.dart

Jul 29th, 2024 (edited)
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 0.53 KB | None | 0 0
  1. import 'package:dio/dio.dart';
  2. import 'package:ementodo/core/utils/constants.dart';
  3.  
  4. class ApiProvider{
  5.   final Dio _dio =Dio();
  6.   var apikey =Constants.apiKey1;
  7. // Current weather api call
  8.  Future<dynamic> callCurrentWeather(cityName) async {
  9.     var response =await _dio.get(
  10. //Constants is a static class in utils folder in core
  11.       "${Constants.baseUrl}/data/2.5/weather",
  12.         queryParameters: {
  13.         "q":cityName,
  14.           "appid": apikey,
  15.           "units": "metric"
  16.         }
  17.     );
  18.     return response;
  19.   }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement