Skip to content

Instantly share code, notes, and snippets.

@doyle-flutter
Created February 15, 2021 01:22
Show Gist options
  • Save doyle-flutter/e67be0b13c7697cd7845a7eae9bc39b3 to your computer and use it in GitHub Desktop.
Save doyle-flutter/e67be0b13c7697cd7845a7eae9bc39b3 to your computer and use it in GitHub Desktop.
Future<void> _handlerSetting() async => await this.server!.listen((HttpRequest event) async {
if (this._handler.isEmpty) return;
for (HandlerModel _hmodel in this._handler) {
Function? c = _hmodel.cb;
String? path = _hmodel.path;
String? method = _hmodel.method;
if (event.uri.path.toString() == path && event.method == method) {
await c!(event, event.response);
await event.response.close();
return;
}
}
return;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment