Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Randal L. Schwartz
@RandalSchwartz
are you using Code or some Jetbrains thing?
Seya Obey
@seyaobey
Could you send me a link for any documentation? I'm really just discovering the whole flutter/dart ecosystem..
I'm using vscode
Randal L. Schwartz
@RandalSchwartz
Ooh, nice
gimme sec
bendixma.dart-data-class-generator
type that into the extensions box
it can take the member vars, and create constructors and equality and == for you
but further, it can take JSON and build all that as well.
And the nice thing is it all happens at edit time, so it’s nice and visible.
Seya Obey
@seyaobey
By the way, I've got the impression that support for graphql seems to still have some issues. I have tried to use flutter artemis package (https://pub.dev/packages/artemis) to auto-generate classes, types and operations from my graphql schema, with no success.
I don't if you may also come to know a better tool in that area
@RandalSchwartz thanks for the tool, I'm looking at it. And it seems promising
Johannes Milke
@JohannesMilke_twitter
Hello! I have created another video about "Flutter Tutorial - Null Safety In 5 Minutes - Flutter & Dart" https://www.youtube.com/watch?v=Q_WloMNKOkU alt
Randal L. Schwartz
@RandalSchwartz
Adding no-sound-null-safety to VSCode command lines automatically: https://youtu.be/-nTEgyNvN2A
Arun S Acharya
@arunsacharyadev
for only one of my screen hot reload is not working, anyone know the reason ?
still no solution
Johannes Milke
@JohannesMilke_twitter
Hello! I have created another video about "Flutter Tutorial - Reorderable ListView - Move List Items" https://www.youtube.com/watch?v=0bRv3mNCj8o alt
Tore93
@Tore93

hello! any who encountered this prob:

E/flutter ( 4978): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: SocketException: OS Error: Connection refused, errno = 111, address = 127.0.0.1, port = 49818

when my http.post / http.get are using another port

many thanks in advance
syle
@syleishere
what is simplest way to get directory from a file path?
syle
@syleishere
oww well guess noone wrote it like python, I'll just use split I guess
Efe: why not just use GetX? Provider and bloc suck
syle
@syleishere
unless you like to have a ton of extra code for no reason I guess
Mansur Segmen
@msegmen
Hello! Have anyone used flutter without ui for shared dart code between ios and android?
joedrt
@joeldrt
@tore93 if you are running your project in an emulator is highly posible that the emulator network doesn’t now about your local network. As a solution you can map your localhost service with ngrok, and then replace your services url with the one that ngrok created for you.
Tore93
@Tore93
@joeldrt never heard of ngrok! Thanks a lot, gonna study that!
Sameer Ahmed
@sxmeer-ahmed
is there anyway to create expansionpanellist with two columns?
Johannes Milke
@JohannesMilke_twitter
Hello! I have created another video about "Flutter Tutorial - In App Rating - Rate My App" https://www.youtube.com/watch?v=zquHzDk7auE alt
syle
@syleishere
you mean an isolate Mansur?
btw guys I did find a way to get the directory path out of the complete path last night
var filePath= FileSystemEntity.parentOf(path);
but whoever wrote that dart code was stoned or lazy that night, cause if you say had Z:/dir1/dir2\dir3
its to stupid to understand forward and backward slashes
syle
@syleishere
YOu might be wondering how I would have such a fix on windows to begin with, well I defined my directory as z:/mp3 in the file, then i would select something like z:/mp3/dir/dir2/blah.mp3, by time it comes back to me with the path I get something like z:/mp3\dir\dir2\song.mp3 , which plays just fine in audio player, but obviously woud screw up if you try to do directory searches or something
Randal L. Schwartz
@RandalSchwartz
so sad Microsoft did it backwards!
richardheap
@richardheap
@syleishere Check out dirname in package:path - https://pub.dev/documentation/path/latest/path/dirname.html
Seya Obey
@seyaobey
How can I display a Webview widget on my screen? Thanks for any suggestion.
Randal L. Schwartz
@RandalSchwartz
on mobile?
Jae
@jaesam
Hi team! I am trying to use svg icon as my slider thumb but do not know how and I couldn't find good resources. Could anyone please help me with this?
Randal L. Schwartz
@RandalSchwartz
I believe svg support is fairly limited. Need more community people coding stuff. :)
Stas
@stasvo
Lets imagine situation when we have FutureBuilder inside widget which have request screen size by MediaQuery.of(context). FutureBuilder have as future value some method from service class which request data from db. In this situation every time when screen size will be changed, for example by rotation or because of change brouser window, widget will be realoded and FutureBuilder will request data from db again and this situation looks terrible, how better to prevent it?
Stas
@stasvo
Hm I see widget will be rebuild when size of app changed even if its not subscribe screensize value in widget by MediaQuery.of(context). And by change browser size FutureBuilder will make several dozen requests to db (or to api).
✭ THE BLACK UNICORN ✭
@iamtheblackunicorn
Here's one question I've been trying to solve for a while now!
import 'dart:io';
import 'dart:math';
import 'dart:async';
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:path_provider/path_provider.dart';
String url = 'https://blckunicorn.art/assets/json/api.json';
Dio dio = Dio();
void main() {
  runApp(
    MaterialApp(
      title: 'Downloading files!',
      home: FlutterDemo(storage: CounterStorage(), apistorage: APIStorage()),
    ),
  );
}
class APIStorage {
  Future<String> get _localPath async {
    final directory = await getApplicationDocumentsDirectory();
    return directory.path;
  }
  Future<File> get _localFile async {
    /*var res = await dio.get(url).catchError((e) {
      throw(e);
    });*/
    try {
      final path = await _localPath;
      Response response = await dio.get(
        url,
        options: Options(
          responseType: ResponseType.json,
          followRedirects: true,
          validateStatus: (status) { return status < 500; }
        ),
      );
      String fullPath = '$path/api.json';
      File(fullPath).writeAsStringSync(response.data.toString());
      print(response.data.toString());
      return File('$path/api.json');
    } catch (e) {
      print(e);
    }
  }
  Future<String> readCounter() async {
    try {
      final file = await _localFile;
      String contents = file.readAsStringSync();
      var resultmap = json.decode(contents);
      return resultmap['sloganOne'];
    } catch (e) {
      return 'Alex';
    }
  }
}
class CounterStorage {
  Future<String> get _localPath async {
    final directory = await getApplicationDocumentsDirectory();
    return directory.path;
  }
  Future<File> get _localFile async {
    final path = await _localPath;
    return File('$path/counter.txt');
  }
  Future<int> readCounter() async {
    try {
      final file = await _localFile;
      String contents = await file.readAsString();
      return int.parse(contents);
    } catch (e) {
      return 0;
    }
  }
  Future<File> writeCounter(int counter) async {
    final file = await _localFile;
    return file.writeAsString('$counter');
  }
}
class FlutterDemo extends StatefulWidget {
  final CounterStorage storage;
  final APIStorage apistorage;
  FlutterDemo({Key key, @required this.storage, @required this.apistorage}) : super(key: key);
  @override
  _FlutterDemoState createState() => _FlutterDemoState();
}
class _FlutterDemoState extends State<FlutterDemo> {
  int _counter;
  String randomString;
  @override
  void initState() {
    super.initState();
    widget.storage.readCounter().then((int value) {
      setState(() {
        _counter = value;
      });
    });
    widget.apistorage.readCounter().then((dynamic value) {
      setState(() {
        randomString = value;
      });
    });
  }
  Future<File> _incrementCounter() {
    setState(() {
      _counter++;
    });
    return widget.storage.writeCounter(_counter);
  }
  Future<void> updateValue() {
    widget.apistorage.readCounter().then((dynamic value) {
      setState(() {
        randomString = value;
      });
    });
  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('Reading and Writing Files')),
      body: Center(
        child: Padding(
          padding: EdgeInsets.only(top: 300),
          child: Column(
            children: <Widget> [
              Text('$randomString'),
              Text('Button tapped $_counter time${_counter == 1 ? '' : 's'}.')
            ],
          ),
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ),
    );
  }
}
Why doesn't the first Text label display 'Animal'?
Because I can see the JSON response in the console.
@RandalSchwartz Let's put those differences from a couple days back aside. I bear no ill will to anybody.
Pisit Makpaisit
@Remixman
I use Image.Network for fetch image resource from amazon s3 but sometimes it returns 403 and crash. How can I fix this problem?