dart - Parameter type confusing -


i trying use virtualdirectory class , find great example in web.

import 'dart:io'; import 'package:http_server/http_server.dart';  main() {     httpserver.bind('127.0.0.1', 8888).then((httpserver server) {         var vd = new virtualdirectory('./');         vd.jailroot = false;         vd.serve(server);     }); } 

look @ call method serve

vd.serve(server); 

and passed parameter, httpserver type. when looking in api docs expected httprequest type.

streamsubscription<httprequest> serve(stream<httprequest> requests) serve stream of httprequests, in virtualdirectory. 

why can pass httpserver instance serve method instead httpreqeust instance?

see documentation of httpserver

the httpserver stream provides httprequest objects.


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -