Search
 
SCRIPT & CODE EXAMPLE
 

DART

get current line number dart flutter

int get lineNumber {
    try {
      final re =
          RegExp(r'^#1[ 	]+.+:(?<line>[0-9]+):[0-9]+)$', multiLine: true);
      final match = re.firstMatch(StackTrace.current.toString());
      return (match == null) ? -1 : int.parse(match.namedGroup('line'));
    } catch (e) {
      return 0;
    }
  }
  
  // Usage
  print('Current line No :$lineNumber');
Comment

get current line number dart flutter

int get lineNumber {
    try {
      final re =
          RegExp(r'^#1[ 	]+.+:(?<line>[0-9]+):[0-9]+)$', multiLine: true);
      final match = re.firstMatch(StackTrace.current.toString());
      return (match == null) ? -1 : int.parse(match.namedGroup('line'));
    } catch (e) {
      return 0;
    }
  }
  
  // Usage
  print('Current line No :$lineNumber');
Comment

PREVIOUS NEXT
Code Example
Dart :: add a button that changes the text in flutter 
Dart :: random.secure dart 
Dart :: Avoid `print` calls in production code 
Dart :: flutter logo curve 
Dart :: Find string index inside a list flutter 
Dart :: @override in dart 
Dart :: dart then method 
Dart :: what is pubspec.yaml 
Dart :: widget capture in flutter 
Dart :: use a class variable in other class in flutter 
Dart :: flutter mouse paralax 
Dart :: floting action button tooltip 
Dart :: onpressed flutter calculate 
Dart :: Which one is performance wise better Text or extracted TextWidget function 
Dart :: Wraps Text Flutter 
Dart :: flutter webview platform._operatingsystem 
Dart :: print $ symbol in dart 
Dart :: print items from list dart 
Dart :: flutter download file 
Swift :: add shadow to collection view cell swift 
Swift :: declaring vs initializing variables 
Swift :: swift func for constraint 
Swift :: swift compare string to button title 
Swift :: swipe left to go back iphone swift 
Swift :: swift convert data to dictionary 
Swift :: swift how to change the header color 
Swift :: get keyboard height swift 
Swift :: swift go to root view controller 
Swift :: swift push view controller programmatically 
Swift :: swift change label text 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =