dart

Dart 2.1.0 smart cast using 'is' not working

心已入冬 提交于 2020-12-23 11:14:25
问题 I'm using the Bloc pattern and have the following code to define my states: import 'package:meta/meta.dart' @immutable abstract class UiState {} class Loading extends UiState {} class Success extends UiState { Success(this.message); final String message; } class Failure extends UiState {} I try to use a UiState as follows: class MyWidget extends StatelessWidget { const MyWidget({ Key key, @required this.uiState, }) : super(key: key); final UiState uiState; Widget build(BuildContext context) {

Dart 2.1.0 smart cast using 'is' not working

梦想的初衷 提交于 2020-12-23 11:14:19
问题 I'm using the Bloc pattern and have the following code to define my states: import 'package:meta/meta.dart' @immutable abstract class UiState {} class Loading extends UiState {} class Success extends UiState { Success(this.message); final String message; } class Failure extends UiState {} I try to use a UiState as follows: class MyWidget extends StatelessWidget { const MyWidget({ Key key, @required this.uiState, }) : super(key: key); final UiState uiState; Widget build(BuildContext context) {

Dart 2.1.0 smart cast using 'is' not working

风流意气都作罢 提交于 2020-12-23 11:13:08
问题 I'm using the Bloc pattern and have the following code to define my states: import 'package:meta/meta.dart' @immutable abstract class UiState {} class Loading extends UiState {} class Success extends UiState { Success(this.message); final String message; } class Failure extends UiState {} I try to use a UiState as follows: class MyWidget extends StatelessWidget { const MyWidget({ Key key, @required this.uiState, }) : super(key: key); final UiState uiState; Widget build(BuildContext context) {

360度全方位观测:React Native与Flutter的跨平台王位之争

吃可爱长大的小学妹 提交于 2020-12-19 09:30:44
360度全方位观测:React Native与Flutter的跨平台王位之争 作者 | Krissnawat Kaewsanmuang译者 | 王强编辑 | Yonie 我们身处科技高速发展的时代;互联网日新月异,移动应用程序开发产业也在大踏步前进。多年来,移动应用的市场需求呈爆发式增长;众多企业都在开发自己的移动应用程序,或者用于促销自己的产品,或者用来向客户提供更好的服务。 众所周知,主导全球市场的两大移动平台分别是 iOS 和 Android。当一家企业决定开发自己的移动应用时,他们需要分别为 iOS 和 Android 平台部署功能相同的应用程序。为此,开发人员需要学习两个平台的不同语言和开发流程,从而在两大平台上构建表现基本一致的应用版本。为了解决这个问题,跨平台框架应运而生,帮助开发者构建可同时适用于 iOS 和 Android 平台的移动应用。如今最流行的两大跨平台应用开发框架就是 React Native 和 Flutter。 跨平台框架发展历史 谷歌和 Facebook 的竞争关系始于 Web 产业。谷歌的 AngularJS 是 Web 应用开发市场中最流行的 Javascript 框架之一。与此同时,由 Facebook 构建的 React 则是在 Web 应用程序开发流程中广泛应用的 JavaScript 库。一般认为 Angular JS 和 React

Flutter开发之Widget布局和页面导航

泪湿孤枕 提交于 2020-12-19 07:17:25
一、水平布局Row Row控件可以分为非灵活排列和灵活排列两种,灵活的可以在外边加入Expanded使用 两者混用: import 'package:flutter/material.dart' ; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { // TODO: implement build return MaterialApp( title: '' , home: new Scaffold( appBar: new AppBar(title: new Text('hello row' )), body: new Row( children: <Widget> [ Expanded ( // 灵活使用 child: new RaisedButton( onPressed: () {}, color: Colors.blue, child: new Text('Blue Button' ), )), new RaisedButton( onPressed: () {}, color: Colors.green, child: new Text('Green Button' ), ), ], ),

lutter可定制的上下滑出抽屉

强颜欢笑 提交于 2020-12-16 09:19:12
前言 Flutter是谷歌的移动UI框架,可以快速在iOS和Android上构建高质量的原生用户界面。 IT界著名的尼古拉斯·高尔包曾说:轮子是IT进步的阶梯!热门的框架千篇一律,好用轮子万里挑一!Flutter作为这两年开始崛起的跨平台开发框架,其第三方生态相比其他成熟框架还略有不足,但轮子的数量也已经很多了。本系列文章挑选日常app开发常用的轮子分享出来,给大家提高搬砖效率,同时也希望flutter的生态越来越完善,轮子越来越多。 本系列文章准备了超过50个轮子推荐,工作原因,尽量每1-2天出一篇文章。 tip:本系列文章合适已有部分flutter基础的开发者,入门请戳: flutter官网 正文 轮子 轮子名称:slide_up_panel 轮子概述:flutter可定制的上下滑出抽屉. 轮子作者:akshath.r.jain@gmail.com 推荐指数:★★★★ 常用指数:★★★★ 效果预览: 效果图 安装 yaml 1 2 dependencies: sliding_up_panel: ^0.3.6 dart 1 import 'package:sliding_up_panel/sliding_up_panel.dart'; 基本使用 dart 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 @override Widget build

Flutter change audio frequency

时间秒杀一切 提交于 2020-12-16 03:51:21
问题 Basically I'm using the plugin sound_stream which it's very nice to record/play or stream the mic audio. I'm trying to do this stream listen to frequency between 2.35Hz and 2.5Hz . How it would be possible to archive this? I learned mainly Java but I'm trying to do both platforms that's why I'm using Flutter. So help/tips are very appreciated. Thank you! 来源: https://stackoverflow.com/questions/62538540/flutter-change-audio-frequency

including the content of the url inside the widget

瘦欲@ 提交于 2020-12-15 19:46:26
问题 i want to get the content of the parsed json value that call URL import 'dart:async'; import 'dart:convert'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; Future<List<Photo>> fetchPhotos(http.Client client) async { final response = await client.get('https://pastebin.com/raw/RfNvKVPp'); return compute(parsePhotos, response.body); } List<Photo> parsePhotos(String responseBody) { final parsed = jsonDecode(responseBody)[

including the content of the url inside the widget

可紊 提交于 2020-12-15 19:38:47
问题 i want to get the content of the parsed json value that call URL import 'dart:async'; import 'dart:convert'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; Future<List<Photo>> fetchPhotos(http.Client client) async { final response = await client.get('https://pastebin.com/raw/RfNvKVPp'); return compute(parsePhotos, response.body); } List<Photo> parsePhotos(String responseBody) { final parsed = jsonDecode(responseBody)[

including the content of the url inside the widget

萝らか妹 提交于 2020-12-15 19:35:40
问题 i want to get the content of the parsed json value that call URL import 'dart:async'; import 'dart:convert'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; Future<List<Photo>> fetchPhotos(http.Client client) async { final response = await client.get('https://pastebin.com/raw/RfNvKVPp'); return compute(parsePhotos, response.body); } List<Photo> parsePhotos(String responseBody) { final parsed = jsonDecode(responseBody)[