Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 07 2019 18:54
    @timsneath banned @hpoit_gitlab
  • Aug 07 2019 18:54
    @timsneath banned @hpoit
  • Jan 31 2019 22:29

    dart-bot on master

    Add pkg/analysis_server/pubspec… (compare)

  • Jan 31 2019 22:12

    dart-bot on master

    First stab at tests for "Spread… (compare)

  • Jan 31 2019 22:10
    jackokring opened #35830
  • Jan 31 2019 21:14

    dart-bot on master

    [vm, gc] Use work stealing for … (compare)

  • Jan 31 2019 21:05

    dart-bot on master

    [vm] Simplify VirtualMemory::Tr… (compare)

  • Jan 31 2019 20:15
    renatoathaydes opened #35829
  • Jan 31 2019 20:13

    dart-bot on master

    [vm] Maintain view-ness of byte… (compare)

  • Jan 31 2019 19:59

    dart-bot on master

    Add the capability in analysis … (compare)

  • Jan 31 2019 19:35
    jmesserly closed #33685
  • Jan 31 2019 19:19
    srawlins opened #35828
  • Jan 31 2019 18:35

    dart-bot on master

    Add a "summary-deps-output" opt… (compare)

  • Jan 31 2019 18:33

    dart-bot on master

    Extract EnumListParameter value… (compare)

  • Jan 31 2019 18:09

    dart-bot on master

    Fix override_on_non_overriding_… (compare)

  • Jan 31 2019 17:46
    stereotype441 labeled #35827
  • Jan 31 2019 17:46
    stereotype441 labeled #35827
  • Jan 31 2019 17:46
    stereotype441 labeled #35827
  • Jan 31 2019 17:46
    stereotype441 opened #35827
  • Jan 31 2019 17:23
    srawlins edited #35826
mark-dropbear
@mark-dropbear
I'm so glad I asked about this now, there is no way I was going to just magically come across that bit of info. I really appreciate it @simolus3
Simon Binder
@simolus3
No worries! The typed_data primitives are not exactly intuitive. By the way, I'm not sure why _decodeBigInt was written like that, I'd probably just do something like this which IMO is a bit nicer to read:
BigInt _decodeBigInt(List<int> bytes) {
  BigInt result = BigInt.zero;

  for (final byte in bytes) {
    // reading in big-endian, so we essentially concat the new byte to the end
    result = (result << 8) | BigInt.from(byte);
  }
  return result;
}
mark-dropbear
@mark-dropbear
Just double checking I didn't misinterpret anything here?
  /// Creates a [Uint8List] of random data of a fixed size.
  static Uint8List _createRandomBytes({required int sizeBytes}) {
    final randomNumberGenerator = Random.secure();
    final Uint8List randomData = Uint8List(sizeBytes);
    for (var i = 0; i < sizeBytes; i++) {
      randomData.add(randomNumberGenerator.nextInt(256));
    }
    return randomData;
  }
Your one is simple enough that even I can understand it :) Am I cool to copy it?
Simon Binder
@simolus3
@mark-dropbear Pretty much, except that you can't .add() to a Uint8List because it is a fixed-length list. You can do randomData[i] = randomNumbergenerator.nextInt(256).
And sure, feel free to copy :)
mark-dropbear
@mark-dropbear
Much appreciated buddy!
Simon Binder
@simolus3
Glad I could help :+1:
mark-dropbear
@mark-dropbear
Yeah you really did me a solid there :) Hopefully, it's a few years between now and the next time I have to touch typed data ;)
Márton Urbán
@marton-urban

Hello, I am new here and reading this tutorial: https://dart.dev/tutorials/language/streams
I am a bit confused, to me it sounds like the tutorial uses function and method almost interchangeably. There is even a subtitle called "The transform() function" (for Streams). Didn't the author mean the transform METHOD? (https://api.dart.dev/stable/2.14.4/dart-async/Stream/transform.html)

I guess it doesn't sound like a big deal, but for novice programmers who try to make sense of everything, shouldn't this be corrected? Or is it acceptable to use them interchangeably?

p.s.: in my understanding, the tutorial is full of methods referred to as functions

Randal L. Schwartz
@RandalSchwartz
They are functions and methods
Some methods are functions. Some functions are methods.
Márton Urbán
@marton-urban

@RandalSchwartz > Some methods are functions. Some functions are methods.

Some functions are methods? Which ones did you mean exactly, could you please give some examples?

Because I can understand that perhaps all methods could be called functions (functions tied to a class or object i.e. static and instance methods), but not "some are this, and some are that", logically doesn't make sense to me, but I am new. Please educate me.

Randal L. Schwartz
@RandalSchwartz
Imagine a Venn diagram. Left circle functions. Right circle methods.
Simple accessors aren't functions to me, just member access. But they occupy the syntax of methods
Márton Urbán
@marton-urban

Imagine a Venn diagram. Left circle functions. Right circle methods.

Thank you for your reply. Would you give some specific examples to all three cases, please? (left circle only, right circle only and intersection).

Jonathan Rezende
@jodinathan
is it possible to batch fix warnings and lints?
Tyler
@tyler:ragtag.club
[m]
You can use Android studios analysis tools to batch fix lints that have fixes
Jonathan Rezende
@jodinathan
it seems I've found it: dart fix
Jonathan Rezende
@jodinathan
dart fix worked as a charm =]
Jonathan Rezende
@jodinathan
I am trying to use typedef for Types however every property with assigned to the typedefis getting a dynamic Function() type instead
Randal L. Schwartz
@RandalSchwartz
Your pubspec is 2.13?
Jonathan Rezende
@jodinathan
yep
I am trying 2.15 but it also happened in 2.14. I will check if it is only in the IDE
Jonathan Rezende
@jodinathan
about the typedef, the app is running ok, but WebStorm (I guess from the analyzer) insists on telling me that the variable is a dynamic Function()
Gabriel Terwesten
@blaugold
I could use some help interpreting this crash stack trace:
===== CRASH =====
si_signo=Segmentation fault(11), si_code=1, si_addr=0x11
version=2.14.0 (stable) (Mon Sep 6 13:47:59 2021 +0200) on "linux_x64"
pid=2867, thread=2980, isolate_group=(nil)((nil)), isolate=(nil)((nil))
isolate_instructions=0, vm_instructions=55a976c08320
  pc 0x0000000000000011 fp 0x00007fdcafafed80 Unknown symbol
-- End of DumpStackTrace
Gabriel Terwesten
@blaugold
Because of the si_addr I think a struct field is being dereferenced on a null pointer.
And the fact that the program counter has the address loaded, which is causing the seg fault, leads me to believe that the struct field should hold a function pointer.
Does that make sense and is the reason that no other frames are displayed that the program counter is completely messed up?
Simon Binder
@simolus3
@blaugold I'm getting the exact same error sometimes! I thought I was to blame because I'm using dart:ffi and I thought I did something wrong. Do you have a source where this reproduces consistently? If it turns out that this is not my fault I can try to reproduce this with my code too to help find the cause.
Gabriel Terwesten
@blaugold
@simolus3 I'm using dart:ffi too, so it might still be a similar usage error :) It's happening randomly in CI and I have not been able to reproduce it locally.
Tomasz Słomiński
@tslominski_twitter
hello; I'am trying to use macro_prototype (https://github.com/jakemac53/macro_prototype) and I can easily add code, but I wonder if there is a way to delete some part of code (or replace it)
realshovanshah
@realshovanshah
I also had a question regarding finding the current classname.
I'm trying to print the name of the class where the code was executed and having trouble achieving this.
I know this isn't JavaScript but was wondering if there was a way to achieve this somehow. Maybe hide the implementation of 'runtimeType' inside a method somehow.
Jacob Bang
@julemand101

@realshovanshah You could get some information from doing StackTrace.current.toString()which will output the stacktrace up to where you are calling StackTrace.current. So the first line should have details about the class and method you are inside.

I would not recommend doing StackTrace.current as part of a production application since it does have some performance concerns. But for debugging or info logning as part of development, it can be useful.

realshovanshah
@realshovanshah
I'd love to hear how everyone here has implemented logging. Logging the class' name to be precise.
Jacob Bang
@julemand101
@realshovanshah You can take a look at: https://pub.dev/packages/simple_logger
It does log the filename and line number of the logning by using StackTrace.current
That package is basically just build on top of https://pub.dev/packages/logging
Where you can also provide the stacktrace for each logging
(you would then manually need to call StackTrace.current to get the stacktrace and provide it to the logging calls)
realshovanshah
@realshovanshah
Thanks @julemand101 i'll try to implement something like this in my logger.
I suppose there isn't any language "exploit" to print the "runtimeType" of a file (that needs to be logged) via a custom logger function? ( without passing it as a function argument )
Tyler
@tyler:ragtag.club
[m]
You can parse the stacktrace, there's a pub package to help with it
whateveruse
@whateveruse
How to run interactive external commands with processing user input and show all output and waiting when executing finished? in example sudo apt install dart or npm install left-pad ?
Jacob Bang
@julemand101
4 replies
GZGavinZhao
@gzgavinzhao:matrix.org
[m]
@whateveruse: Use ProcessStartMode.inheritStdio.
var process = await Process.start('sudo', ['mysql_secure_installation'], mode: ProcessStartMode.inheritStdio);

// The process will start running.

// If you want to pause everything before the previous command exits, use below:
await process.exitCode;
It literally took me a year to find this thing...