Giter VIP home page Giter VIP logo

flutter-interview-questions's Issues

Future<HttpClient> is not a subtype of HttpClient

import 'dart:io';    
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_app_retrofit/example.dart';

class Homepage extends StatefulWidget {
@override
HomepageState createState() => HomepageState();
}

class _HomepageState extends State<Homepage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Center(
child: FutureBuilder(
future: this._getPosts(),
builder: (context, snapshot) {
switch (snapshot.connectionState) {
case ConnectionState.none:
return CircularProgressIndicator();
break;
case ConnectionState.waiting:
return CircularProgressIndicator();
break;
case ConnectionState.active:
return CircularProgressIndicator();
break;
case ConnectionState.done:
return CircularProgressIndicator();
break;

default:
return CircularProgressIndicator();
     }
   },),
 ),
);
}

Future _getPosts() async {
final dio= Dio();
(dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate = await (client) async {
SecurityContext securityContext=new SecurityContext();
final ByteData crtData = await rootBundle.load('assets/server.crt');
securityContext.setTrustedCertificatesBytes(crtData.buffer.asUint8List());
final ByteData keyBytes = await rootBundle.load('assets/server.key');
securityContext.usePrivateKeyBytes(keyBytes.buffer.asUint8List());
return HttpClient(context: securityContext);
};
final client = RestClient(dio);
client.login('madhusudhan@****.in', '88888');

}}

In flutter we are getting using Dio. I am getting a error using Dio The problem is here that i need to use SSl certificate So i used Dio But now i am getting the below error. Unhandled exception Future is not a subtype of HttpClient.

Answers?

Maybe someone could answer those questions :)

This could become the best flutter interview preparation source.

I am new to flutter and i am developing flutter app I want to call a function inside the column but it said null values.i have tried to show the Title1() function inside the Photo() class but it shows error.

[class Internal extends StatefulWidget{

      @override
      _InternalState createState()=>_InternalState();
    
    }
    class _InternalState extends State<Internal> {
    
      bool isSearching=false;
      Photo(int number,){
        return Scaffold(
          backgroundColor: Color(0XFFfffafa),
          body: SafeArea(
          child: SingleChildScrollView(
            child: Container(
              child: Stack(
                children: <Widget>[
                  Container(
                    height: 19,
                    child: Padding(
                      padding: const EdgeInsets.only(right:360.0),
                      child: IconButton(icon: Icon(Icons.arrow_back,color: Colors.black,size: 30,), onPressed: (){
                        Navigator.push(
                          context,
                          MaterialPageRoute(builder: (context) => Internal()),
                        );
    
                      }),
                    ),
                  ),
                Title1(number),
                ClipRRect(
                  borderRadius: BorderRadius.only(topRight: Radius.circular(40.0),topLeft: Radius.circular(40.0)),
                  child: Image(image:  AssetImage('images/song$number.jpg'),),
                ),
                ],
              ),
            ),
          ),
        ),
    Title1(int number){
      number=1;
      Container(
        margin: EdgeInsets.only(left:37.0,right: 37,bottom: 10),
        child: Center(child: Text('Tempo : 102\nStyle : Waltz\nChord : C\nTranspose : 4',
          style: TextStyle(color: Colors.white,fontFamily: 'SourceSansPro',fontWeight: FontWeight.w600,fontSize: 20),)),
        height: 120.0,
        width: 380,
        decoration: BoxDecoration(shape: BoxShape.rectangle,color: Color(0XFF40404F),borderRadius: BorderRadius.circular(20.0)),
      );
      number=2;
      Container(
        margin: EdgeInsets.only(left:37.0,right: 37,bottom: 10),
        child: Center(child: Text('Tempo : 102\nStyle : Waltz\nChord : C\nTranspose : 2',
          style: TextStyle(color: Colors.white,fontFamily: 'SourceSansPro',fontWeight: FontWeight.w600,fontSize: 20),)),
        height: 120.0,
        width: 380,
        decoration: BoxDecoration(shape: BoxShape.rectangle,color: Color(0XFF40404F),borderRadius: BorderRadius.circular(20.0)),
      );
    }
    );
  }

Categorize Questions based on Developer Level

Hey @whatsupcoders

I was wondering if we can categorize the questions based on the developer level. From my experience, not all questions are made for Junior developers. However, this is open to suggestions.

I am looking at the following category:

1. Senior Developer
2. Junior Developer

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.