Issue I did the following test, but it doesn’t work: //main.dart class Test { static const a = 10; final b = 20; final c = a+1; } //part.dart part of ‘main.dart’; class Test { final d = a +1;
Continue readingCategory: Dart
Dart source code for basic mathematical functions
Issue Just out of interest I recently tried to take a look at the source code of some basic mathematical functions in the dart programming language (more specifically, in the dart:math package). Take e.g. the cosine function. It was easy
Continue readingNull check operator used on a null value happening only in release mode
Issue When lauching my app in release mode (using flutter run –release) or by building an apk, I get strange behaviors, as if setState() was not entierly reloading the widgets. When launching flutter run –release –verbose, I get the following
Continue readingDart – Map with Set as key
Issue I’m trying to construct a Map object with Set as keys: final myObject = <Set<MyType1>, MyType2>{}; I can successfully insert new values in my object myObject[{myType1}] = myType2; However, I cannot get back anything from it as 2 sets
Continue readingHow to handle errors coming back from Futures when I am not awaiting the Future?
Issue I have something like this: Future<void> f1() { … } Future<void> f2() { … } Future<void> f3() { … } void main() async { f1(); f2(); // might throw an Exception await f3(); } Note – I am deliberately
Continue readingDart Mirrors Not Supported When Compiling Using arm64v8/dart Docker Image
Issue Have a pure Dart server app which is currently using ‘dart:mirrors’ in a class to do a bit of light reflection work at runtime. The server app compiles and runs absolutely fine in development Ubuntu machine with x86 architecture
Continue readingHow to draw triangle with rounded corner
Issue I need to create a triangle with rounded corners like this. How can I implement this? I’ve tried searching for related answers, but only found implementations without rounded corners. Is there any way to implement a similar triangle without
Continue readingDart test with roughly equal
Issue I am now trying to use dart:test features. I can write something like: expect(areaUnderCurveWithRectangleRule(f1, 0,1,1000), equals(2)); But as we know, in float/double calculation, there is no such thing as precise equal. So I am wondering if there is a
Continue readingCalculating substring position in Flutter TextField
Issue I am trying to draw an OverlayEntry over a part of the text of a TextField. Like in this screenshot. I am showing only the code to get the top offset position for the selected text, because this is
Continue readingUse static variable in function()
Issue I would know if we can declare a static var in a function, as we can do in JavaScript. When I callback my function, my variable keep her last affectation. Or can I only use global variable (it’s not
Continue reading