flutter-web

How to make HTTP Requests on Flutter For Web?

你离开我真会死。 提交于 2019-12-02 04:28:39
I am building an application that executes HTTP requests to a NodeJS Server but when i execute an HTTP request the result is the following: Access to XMLHttpRequest at 'http://127.0.0.1:8000/' from origin 'http://127.0.0.1:8080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. and Uncaught (in promise) Error: XMLHttpRequest error. dart:sdk_internal 41864:30 get current package:http/src/packages/http/src/browser_client.dart 84:22 <fn> dart:sdk_internal 99587:96 <fn> at

How to get the file selected

谁说胖子不能爱 提交于 2019-12-01 10:35:04
问题 I am building a flutter web using old version. I am having a FileUploadInputElement. I need to get the file selected from that element. @override Widget build(BuildContext context) { FileUploadInputElement fileUploadInputElement = FileUploadInputElement(); ui.platformViewRegistry.registerViewFactory( 'animation-Image-html', (int viewId) => fileUploadInputElement); return SizedBox( child: HtmlElementView( viewType: 'animation-Image-html', ), ); } 回答1: You can directly use the element.files

How to host Flutter Web (Hummingbird) on Firebase Hosting

廉价感情. 提交于 2019-12-01 00:50:29
I created a flutter web project and work fine in localhost. So I planned to host the website in firebase. I followed the commands it deployed successfully but it shows only black screen in the console it shows error message. Error : Loading failed for the with source “ https://myportfolioflutterweb.firebaseapp.com/web/main.dart.js ”. SyntaxError: expected expression, got '<'[Learn More] My Project Structure : firebase.json : { "hosting": { "public": "public", "ignore": [ "firebase.json", "**/.*", "**/node_modules/**" ], "redirects": [ { "source": "/", "destination": "/web/index.html", "type":

Which map solution / package to use with Flutter Web?

霸气de小男生 提交于 2019-11-30 18:49:53
问题 I am porting over a flutter mobile project to flutter web and was curious which map package to use in place of: https://pub.dev/packages/google_maps_flutter 回答1: I was able to get a workable solution, but it isn't pretty. Below is the implementation. If I get some time and a legit port doesn't come a long I will post an example repo. import 'dart:html'; import 'package:flutter_web/material.dart'; import 'package:lift_ai/base/screen_state.dart'; import 'package:lift_ai/feature/property_common

How to save to web local storage in flutter web

允我心安 提交于 2019-11-30 03:42:36
问题 I have a web site built with flutter for web and currently, am trying to save to web local storage or cookie but can't seem to find any plugin or way to archive that. 回答1: You can use window.localStorage from dart:html import 'dart:html'; class IdRepository { final Storage _localStorage = window.localStorage; Future save(String id) async { _localStorage['selected_id'] = id; } Future<String> getId() async => _localStorage['selected_id']; Future invalidate() async { _localStorage.remove(