Tuesday, September 20, 2022

How to Generate RSA Private Keys in Oracle Cloud Infrastructure OCI Tenancy?

 RSA Private Keys

Click on your Profile > Go to oracleidentitycloudservice/_userid_





At the bottom of this page, you will find API Keys


Click on Add Key to generate private or public keys.



Download Private RSA keys


                                                    ✍ It's Done. ✌

Friday, August 26, 2022

Get Month name and Week name in Dart Flutter

 import 'package:intl/intl.dart';


void main() {

  print(DateTime.now().month); // get current month number

  print(DateTime.november); // get given month number

 

  DateTime date = DateTime.now();

  print(DateFormat('MMMM').format(date)); // get current month name

  print(DateFormat('EEEE').format(date)); // get current week name

}


// below url has the supported set of skeletons, e.g., 'MMMM', 'EEEE'

// https://api.flutter.dev/flutter/intl/DateFormat-class.html#:~:text=constructor%20is%20preferred.-,ICU,-Name%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Skeleton%0A%20%2D%2D%2D%2D%2D%2D%2D%2D%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2D%2D%2D%2D%2D%2D%2D%2D%0A%20DAY


.map() method in DART

 import 'dart:convert';

Welcome welcomeFromJson(String str) => Welcome.fromJson(json.decode(str));

void main() {
  Map<String, dynamic> json = {"items":[{"id":83,"description":"Test 1"}]};
  List myList = List<Item>.from(json["items"].map(myFunc));//(x) => Item.fromJson(x)));
  print(myList[0].eId);
  print(myList[0].eDescription);
}

myFunc(x) {
  print(x); // {id: 83, description: Test 1} // output of .map() method
  return Item.fromJson(x);
}

class Welcome {
    Welcome({
        required this.items,
    });

    List<Item> items;
 
    factory Welcome.fromJson(Map<String, dynamic> json) => Welcome(
        items: List<Item>.from(json["items"].map((x) => Item.fromJson(x))),
    );  
}

class Item {
    Item({
        this.eId,
        this.eDescription,
    });

    int? eId;
    String? eDescription;

    factory Item.fromJson(Map<String, dynamic> json) => Item(
        eId: json["id"],
        eDescription: json["description"],
    );
}