var data;
var url = Uri.parse('www.api.com',);
Future<String> getData(url) async{
var onlineData = await http.get(url, headers:<String, String> {"Authorization":"dsdsfcd7b-13dsdde0-635gdasdc-041fssffbacf"}
);
var jData = jsonDecode(onlineData.body);setState(() {
data = jData;
print(jData.runtimeType);
print(data);
});
return 'success';
}
@override
void initState() {
super.initState();
getData(url);
}

following these steps you can easy to add authentication key in headers

--

--

import ‘package:flutter/material.dart’;void main() => runApp(MaterialApp(title: “game”,home: MyApp(),));class MyApp extends StatefulWidget {@overrideState<StatefulWidget> createState() {return _MyAppState();}}class _MyAppState extends State<MyApp> {@overrideWidget build(BuildContext context) {return Scaffold(appBar: AppBar(title: Text(“dashboard”)),drawer: Drawer(child: Column(children: <Widget>[Container(color: Theme.of(context).primaryColor,width:double.infinity,child:Column(children: <Widget>[Container(margin: EdgeInsets.only(top:30, bottom: 20),width: 85,height: 60,decoration: BoxDecoration(shape: BoxShape.circle,image: DecorationImage(image:NetworkImage(“https://cdn.worldvectorlogo.com/logos/flutter-logo.svg"))),),Text(“Game”,style: TextStyle(color: Colors.white, fontSize: 20,),),],),

Read More

--

--

  • It is a systematic approach to find and implement the solution to a problem.

Program

  • It is a set of instructions written in computer languages.

Steps in Problem Solving

•Problem Definition

•Problem Analysis

•Design

•Coding

•Testing

  • Maintenance

--

--