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

C# random value from dictionary and tuple -

cgi - How do I interpret URLs without extension as files rather than missing directories in nginx? -

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